Timeline for Implement Singleton that loads before Awake
Current License: CC BY-SA 4.0
7 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Dec 13, 2023 at 18:51 | history | edited | Pikalek | CC BY-SA 4.0 |
added markdown to code in text
|
| Dec 13, 2023 at 14:46 | answer | added | DMGregory♦ | timeline score: 1 | |
| Dec 13, 2023 at 14:33 | comment | added | PepeOjeda |
@DMGregory is correct, although there is a bit of complication if you have multiple scenes open at the same time, as the Awake method of all MonoBehaviours in the first scene will always be called before any MonoBehaviours in the next one. An alternative that might or might not work for you, depending on what this Singleton is doing, is to instantiate it the first time someone tries to access it through the instanceproperty. Or maybe you can use RuntimeInitializeOnLoad.
|
|
| Dec 13, 2023 at 14:13 | comment | added | DMGregory♦ | "As far as I know, the order in which Awake functions execute can't be configured" If I recall correctly, you can configure the order of Awake with the Script Execution Order settings | |
| Dec 13, 2023 at 13:41 | history | edited | vandermies | CC BY-SA 4.0 |
added 3 characters in body
|
| S Dec 13, 2023 at 13:41 | review | First questions | |||
| Dec 13, 2023 at 18:51 | |||||
| S Dec 13, 2023 at 13:41 | history | asked | vandermies | CC BY-SA 4.0 |