|
I'm primarily looking for a unified solution to manage certain application level logic, e.g. dependency injection. I was hoping that there was some way that I could identify a class, or script, as code to be executed on application start up where the objects initialized would live for the life of the application (i.e. the game). Barring that I figure I can attach initialization code to a game object on a per scene basis. I don't really like that as a solution, as I hate the idea of dependencies that need to be managed, essentially manually, for every scene. (That and I'd also like to avoid the unnecessary task of reinitializing objects on a scene-by-scene basis when the user moves from one scene to the next).
(comments are locked)
|

You do know about DontDestroyOnLoad, don't you? It's kind of exactly what you need here.
That's right! I forgot about that. I've been in and out of the documentation so often, but haven't used more than half of what I've read. I'll have to give that a shot. Thanks for the reminder!
I usually use a seperate start scene which holds all manager objects (one one gameobject with DontDestroyOnLoad). This scene shouldn't be loaded ever again since this would duplicate the managers ;)
Therefore the start scene (level 0) immediately loads the mainmenu level. For in-editor-testing i just have a simple script in each scene which checks for the manager and if it's not there it loads the start scene. So you always have the same starting point.
Yeah, that's what I usually do.
I appreciate the feedback. I was thinking about the idea of a load screen while on my way into work; given what both of you are saying, it sounds like that is pretty much the accepted way of accomplishing what I'm looking to do. Thanks again!