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

Scripting

-

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

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.