Singleton Effectivity

Hello,
I was just wondering if this is the only way to create Singleton in Unity? Because it does not seem like a very effective way. You create something than count if that’s the only object and if not you destroy it. So you are creating some new objects which are then just destroyed immediately.

Like most things, there’s always another way to do it. I think the main reason for this setup is for you as the developer. Let’s say you have a singleton that keeps track of your game session, you could just put that in your first scene and DontDestroyOnLoad but what if you wanted to test from scene two? Now that singleton doesn’t exist.

1 Like

Makes sense, thank you for your answer.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms