Roundbeargames | Singletons & Managers in Unity - Tutorial by Roundbeargames @Roundbeargames | Uploaded November 2019 | Updated October 2024, 1 hour ago.
Singletons & Managers in Unity
Tutorial by Roundbeargames
Usually the use of singletons is not recommended, but for a simple indie game, it might be ok as long as you don't overdo it.
Personally, I like to use singletons to hold a list of a group of objects:
- Character Manager for example, has the list of all the characters in the scene
- Virtual Input Manager has all the public variables for possible presses like up, down, left, right, etc).
From any class, you can access the Character Manager by using "CharacterManager.Instance" or the Virtual Input Manager through "VirtualInputManager.Instance". You don't have to worry about instantiating a manager class. It's done automatically the first time you call the public method.
Singletons:
en.wikipedia.org/wiki/Singleton_pattern
Static variables:
en.wikipedia.org/wiki/Static_variable
Unity3D Managers vs Controllers:
youtu.be/T39tyyQjFSQ
C# Generics:
youtu.be/5ds30gSotPc
Files are available here:
drive.google.com/drive/folders/17Lfpa5r-3zeR1jaT0eJ4nqIR3pkU9ABE?usp=sharing
Download this project:
github.com/RoundBearChoi/2.5D_Platformer_Unity
Tutorial playlist:
youtube.com/playlist?list=PLWYGofN_jX5BupV2xLjU1HUvujl_yDIN6
Any questions/comments? Join us on discord:
discord.gg/hAFTgcA
Social
twitter: twitter.com/roundbeargames
facebook: facebook.com/roundbeargames17
hive: peakd.com/@roundbeargames/posts
reddit: reddit.com/user/roundbeargames
linkedin: linkedin.com/in/jangwon-choi-roundbeargames
Patreon:
patreon.com/roundbeargames
Channel Memberships:
youtube.com/roundbeargames/join
#gamedev #indiegame #unitytutorial #devlog
Singletons & Managers in Unity
Tutorial by Roundbeargames
Usually the use of singletons is not recommended, but for a simple indie game, it might be ok as long as you don't overdo it.
Personally, I like to use singletons to hold a list of a group of objects:
- Character Manager for example, has the list of all the characters in the scene
- Virtual Input Manager has all the public variables for possible presses like up, down, left, right, etc).
From any class, you can access the Character Manager by using "CharacterManager.Instance" or the Virtual Input Manager through "VirtualInputManager.Instance". You don't have to worry about instantiating a manager class. It's done automatically the first time you call the public method.
Singletons:
en.wikipedia.org/wiki/Singleton_pattern
Static variables:
en.wikipedia.org/wiki/Static_variable
Unity3D Managers vs Controllers:
youtu.be/T39tyyQjFSQ
C# Generics:
youtu.be/5ds30gSotPc
Files are available here:
drive.google.com/drive/folders/17Lfpa5r-3zeR1jaT0eJ4nqIR3pkU9ABE?usp=sharing
Download this project:
github.com/RoundBearChoi/2.5D_Platformer_Unity
Tutorial playlist:
youtube.com/playlist?list=PLWYGofN_jX5BupV2xLjU1HUvujl_yDIN6
Any questions/comments? Join us on discord:
discord.gg/hAFTgcA
Social
twitter: twitter.com/roundbeargames
facebook: facebook.com/roundbeargames17
hive: peakd.com/@roundbeargames/posts
reddit: reddit.com/user/roundbeargames
linkedin: linkedin.com/in/jangwon-choi-roundbeargames
Patreon:
patreon.com/roundbeargames
Channel Memberships:
youtube.com/roundbeargames/join
#gamedev #indiegame #unitytutorial #devlog