Search Issue Tracker
Won't Fix
Votes
0
Found in
5.4.1f1
Issue ID
846907
Regression
No
Method with [RuntimeInitializeOnLoadMethod()] attribute with "BeforeSceneLoad" parameter is not invoked before scene load
Method with attribute [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType loadType)] with parameter "RuntimeInitializeLoadType.BeforeSceneLoad" is not invoked before scene load
To reproduce:
1. Open the project attached by the user
2. Open the console window
3. Attach the only script in the project to any object in the Hierarchy
3. Enter play mode
4. Notice the order of the messages appearing in the console
In Editor everything is working as expected and OnAfterDeserialize() is called after user's method EditorInitializeOnLoad() with attribute [UnityEditor.InitializeOnLoadMethod] Initializes a GameObject
5. Build the project in development mode and run it
6. Notice the messages in the console
Comparing them to the ones in the editor it is obvious that the order in which the methods were called is wrong as OnAfterDeserialize() is called before user's method
RuntimeInitializeOnLoad() was called even though it has Attribute [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType loadType)] with parameter "RuntimeInitializeLoadType.BeforeSceneLoad"
Reproduced on: 5.6.0a1, 5.5.0b10, 5.4.2p2, 5.3.6p7
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- [OpenGLES][XR] Zooming in on the camera's URP opaque texture causes "double vision" on Quest in OpenGLES3
- “[Worker0] Could not generate preview image“ error when opening macOS native plugin in the Inspector with Architecture to build for set to ARM 64-bit
- [iOS] Application.absoluteURL is empty on Awake/Start when opening via deep link with Splash Screen disabled
- Crash on MemoryManager::Deallocate when rapidly calling Addressables.LoadAssetAsync
- Crash on physx::shdfnd::atomicIncrement when adjusting values on a character controller component after entering Play mode in Prefab edit mode
Add comment