Unity C# Intermediate Tutorial - Super Simple Singleton Pattern

preview_player
Показать описание
A short tutorial on a simple implementation of a Singleton pattern or Static classes in Unity. Aimed at intermediate Unity users. Singletons help us centralize and declutter our Unity classes. Making commonly used functions easily accessible from anywhere in our games project.

Written & Produced by Trent Naylor

Thanks for watching. For more tutorials and games made by Pygmy Tyrant check us out on

Twitter :

Facebook :

Instagram :
Рекомендации по теме
Комментарии
Автор

I just went through a bunch of tutorials for a simpleton implementation. Yours is the one that worked for me, even though it was made 9 years ago. Thanks!

NaciDilekli
Автор

Simplest explanation of singletons I have found so far. Thank you sir!

cfl
Автор

All the time I have problems with inhertitance and structure. You are my saviour now.

nikitatikhomirov
Автор

This is really simple way to use singleton pattern. Good job

sametoruc
Автор

Thank you very much for this! Very simple indeed.

havinalmassi
Автор

thank you brother. very useful and clear.

halvedbagel
Автор

Thanks! Using this for a sound manager.

turbulencegames
Автор

Amazing, I will use this to manager sounds, thanks so much :)

elizaknight
Автор

Awesome Tutorial. Very well explained and executed.

jamesh
Автор

I don't usually trust people who say G.U.I as Gu-ei but i will trust you. :)

sachinjagotra
Автор

Is there a reason why you didn't use the if (instance == null) { ...} else { Destroy(gameObject); ?

nibernator
Автор

Huh, so i was using singletons for a while now, i just didnt knew they were called that haha...

NevaranUniverse
Автор

Awesome this is exactly what I needed to know! Thanks for making this

BradenLehman
Автор

Nice, but it would be better to access the singleton though a property.

SharpData
Автор

Which is better and faster and safer Singleton Or inhertitance (Make the Other classes inherit for the main one And Putting Some Variables Protected isnt this better)

TheSphynxoid
Автор

I've been trying to figure out what a singleton is for a while now, since it's mentioned a LOT in the #Unity3D chatroom. Is it just the self-instantiation of a manager script? What is the advantage of that, compared to single-scene game management (where you don't have the problem with lost variables due to the scene never changing)?

morphman
Автор

you are not preventing instantiation from the singleton, which makes this not a real singleton.

marcheever
Автор

From the Channel name i thought you were Indian.

ahmedelakrab
join shbcf.ru