I tried digging into the API but couldn't find a way of programmatically assigning the Listener value for world variables in the WorldVariablesTracker script (I've had to move the LevelWaveSettings instance to the start scene where my main player UI doesn't exist yet, so I can't just drag and drop the text UI with the WorldVariableListener component on it)
I was hoping for something like this (which would be called on Start in the next scene)...
As always, thank you for the incredibly fast response.
Here's the scene loading logic for my game. After the initial menu scene, the player goes through SceneA (plays to half way through) then reaches a trigger which loads SceneB. At the end of this level, SceneA loads again and continues.
Version 1 had separate instances of LevelWaveSettings for each scene, but the Pool has the same prefabs in both Scene A and Scene B (there are no spawned prefabs in the MainMenu) It's quite a large number of particle systems and enemies (currently a little over 50, and likely to grow)
So my thinking was that it was inefficient to have this duplication and re-initialisation of gameObjects in the pool, between scenes, (especially as Scene B and the reloading of SceneA are done additively). The refactored version just holds everything in one instance of LevelWaveSettings and persists across all scenes.
... but then I have the problem of not being able to assign my Player UI to the WorldVariable listener slot.
Last Edit: Dec 31, 2017 15:39:17 GMT by baroquedub
DarkTonic.CoreGameKit.LevelSettings:Awake() (at Assets/Plugins/DarkTonic/CoreGameKit/Scripts/Level/LevelSettings.cs:298) What would be the best way for me to make this a true singleton? Add my own singleton script on the gameObject? I expected the 'Persist between scenes' setting to do this but apparently it's only adding DontDestroyOnLoad.
This won't happen if you use a Bootstapper Scene for all your persistent objects. That's a Scene that has all the persistent object, and immediately loads the first "real" Scene. It goes by in an instant and you never visit is again, so you can't have the problem of 2 of a singleton showing up at the same time.