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
- Volumetric fog shader variants are missing from build when "Strict Shader Variant Matching" is disabled
- Unnecessary modifications clutter the Scene when using a RectTransform driven by a LayoutGroup in a Prefab
- Files in the target folder are deleted without a proper warning when building an iOS project
- Character animation freezes when toggling animator on/off in a coroutine
- Certain textures are incorrectly marked in the render pass list when observed through Render Graph Viewer
Add comment