UnityCommunity / UnitySingleton

The best way to implement singleton pattern in Unity.
https://en.wikipedia.org/wiki/Singleton_pattern
MIT License
446 stars 59 forks source link

Scene Singleton Pattern #6

Closed starryforest-ymxk closed 9 months ago

starryforest-ymxk commented 9 months ago

In some cases we should use this pattern, it differs from the traditional "Global singleton pattern", the purpose of "Scene Singleton Pattern" is to ensure that there is only one instance of the class in a given scene, but it does not require that instance to persist across scenes. This pattern is useful when you need to manage certain assets or features in a single scene, but you don't want those assets or features to remain present when the scene is switched.

hasanbayatme commented 9 months ago

Yeah absolutely, that's a nice addition, thank you!