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
- "Rendering Debugger" displays incorrect overdraw count when using "Unlit/Texture" shader
- Scene and Game views break when the Editor window is snapped with the Microsoft PowerToys
- Materials do not transfer texture when the "Shader" parameter is changed from "Unlit/Texture" to "Universal Render Pipeline/Unlit"
- [Linux][Vulkan] Crash when opening searchable dialog
- The "Shader error in 'AE/Leaves': "Undefined punctual shadow filter algorithm"" error appears when build completes on a specific project
Add comment