Simple tu use and foolproof. It uses abstraction to make it almost invisible on your code and easy to reuse it.
- Inherid on your class:
public class MyMonoBehaviour : Singleton<MyMonoBehaviour>
{
public bool ExampleBool;
}
- Call it from another script:
MyMonoBehaviour.Instance.ExampleBool;
Same instructions for SingletonPersistent.cs
- Any Unity version
- Any pipeline (Build-in, URP, HDRP, etc)
⭐ Star if you like it
❤️️ Follow me for more