Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Discussion One manager to control them all

Discussion in 'Editor & General Support' started by Rivax95, Nov 30, 2022.

  1. Rivax95


    Oct 17, 2017
    Hi guys, for a while now I've been looking for the best and most efficient way to initialize the managers of my game (manger of managers), I want to have full control to manage the initialization flow.
    I have read some posts from the community and I see that they all face the same problem

    • What is the most efficient and decoupled way to manage the services / managers?

    • Manage memory and avoid serious momentary drops in fps

    • What would be the best approach to design this architecture?

    • What questions do I have to ask myself when approaching this?

    • (Like, I have to wait for some HTTPs call to get some critical data on initialization, I have to wait for third party services to initialize ??)

    • What systems are persistent between scenes and how to decouple them when we are not interested in knowing anything about them?

    As you can see, it is a recurring theme and I would like to be able to discuss this and see what approaches you give to your projects and what are those "final bosses" that are so complex to handle.
    In my case, I have third-party assets that handle many things for me, like audio, character controller, etc... and I only have a coroutine that initializes all my systems, managing the flow.

    I haven't found anything on github that references this, it just doesn't seem to exist, but the problem with this approach is persistent between different projects...
  2. Kurt-Dekker


    Mar 16, 2013
    That's because the answer is completely different between different projects and different engineers.

    Some people hack it all together and it's a nightmare.

    Some people object-orient and MVVC the entire thing and it's also a nightmare.

    I tend to operate somewhere in the middle between these two extremes.

    But even then sometimes it's a nightmare, and I have to try to sort it out, which I do.

    I suggest you try lots of stuff, see what works well, see what works poorly, and do more of the "works well" parts, and amend your strategies on the "works poorly." parts.

    And those will be 100% different on EVERY project, for EVERY engineer, EVERY time.