runtimeinitializeonload
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| runtimeinitializeonload [2021/05/07 19:28] – Add footnote that this was also tested in 2020.1.17.f1 bhanson | runtimeinitializeonload [2025/01/15 04:35] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 10: | Line 10: | ||
| * __//Unity MonoBehaviour.Awake() runs here//__ | * __//Unity MonoBehaviour.Awake() runs here//__ | ||
| * AfterSceneLoad, | * AfterSceneLoad, | ||
| - | * __//Unity MonoBehaviour.Start() runs here//__ | ||
| Providing no load type defaults to RuntimeInitializeLoadType.AfterSceneLoad, | Providing no load type defaults to RuntimeInitializeLoadType.AfterSceneLoad, | ||
| + | |||
| + | 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.1620415682.txt.gz · Last modified: 2025/01/15 04:35 (external edit)