Creating Manager Classes in Unity

Within a game big or small, it becomes necessary to have a class that allows you to control the game itself, we’re talking about the state of the game rather than the UI or audio.

In Unity, we can define these classes through c# scripts and assign them to empty GameObjects with the same name, within the game scene.

Each manager class deals specifically with its field of expertise.
When we create one of these classes we always define a static variable with the same type as the class itself, to create what will be its instance. This will allow us to call it from outside without having to use the ‘Find’ and ‘GetComponent’ instructions.

But we can’t allow this instance to be modifiable so we build a public property of the class that allows us to call it but not to modify it.

The foundation of this system is the design pattern called Singleton that together with the Properties I will deepen later.

project manager by day, unity developer by night

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Make HTTP Request Using Your Solidity Smart Contract

The Fog of War

How to choose the right software house for your project


REST API with SpringBoot (Kotlin / Java)

The Intelliconnect Engineering Blog

cilory customer care number 6289687993//6289687993cilory customer care number…

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Andrea Alicino

Andrea Alicino

project manager by day, unity developer by night

More from Medium

Adding a Main Menu to our UI

Platformer: Elevator

Structuring Your Unity Code For Production: Important Best Practices

My journey becoming a Unity game developer: Main Menu: Main Menu Music and Start button activated