This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
runtimeinitializeonload [2021/06/18 00:25] andrew900460 verified the execution order in new unity version |
runtimeinitializeonload [2022/01/26 04:23] (current) 187.190.156.255 |
||
---|---|---|---|
Line 15: | Line 15: | ||
Other versions that have been verified to also use this exact order: | Other versions that have been verified to also use this exact order: | ||
* 2021.1.12f1 (editor only) | * 2021.1.12f1 (editor only) | ||
+ | |||
+ | Methods with RuntimeInitializeLoadType.AfterSceneLoad, | ||
+ | |||
+ | Another important thing is that the method should be static! | ||
+ | ---- | ||
+ | |||
+ | ===== Other Nuanced Info ===== | ||
+ | |||
+ | If you create a GameObject and attach a MonoBehaviour to it in " | ||
+ | |||
+ | Example: | ||
+ | <code cs> | ||
+ | [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)] | ||
+ | static void AutoRun() { | ||
+ | GameObject obj = new GameObject(" | ||
+ | } | ||
+ | </ | ||
+ | ---- | ||
+ | |||
+ | [[https:// |