runtimeinitializeonload
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
runtimeinitializeonload [2021/04/14 03:12] – created 73.95.178.156 | runtimeinitializeonload [2025/01/15 04:35] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== | + | ====== |
- | The order of callbacks is: ((tested in the editor, 2020.2.1f1)) | + | The documentation is not correct about this function running after awake. It does by default, but not if you specify a load type: |
+ | |||
+ | The order of callbacks is: ((tested in the editor, 2020.2.1f1 | ||
* SubsystemRegistration | * SubsystemRegistration | ||
* AfterAssembliesLoad | * AfterAssembliesLoad | ||
- | * BeforeSplashScreen((On 2019, this call didn't seem to run in the editor)) | + | * BeforeSplashScreen((On 2019, this call didn't seem to run in the editor, I think this was fixed with the addition of the previous two load types.)) |
* BeforeSceneLoad | * BeforeSceneLoad | ||
- | * //Unity MonoBehaviour.Awake() runs here// | + | * __//Unity MonoBehaviour.Awake() runs here//__ |
* AfterSceneLoad, | * AfterSceneLoad, | ||
- | Providing | + | Providing |
+ | |||
+ | Other versions that have been verified to also use this exact order: | ||
+ | * 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:// |
runtimeinitializeonload.1618369945.txt.gz · Last modified: 2025/01/15 04:35 (external edit)