Singleton instancing

Use this to allow to create and maintain a single instance of the class that allows another class to access its methods and properties


class TestClass {
    private static TestClass _Instance;
    public static TestClass Instance
    {
        get
        {
            if (_Instance == null)
            {
                _Instance = FindObjectOfType<TestClass>();
            }

            return _Instance;
        }
    }
    public void TestMethod()
    {
    }
}
    

To use in another class

class AnotherClass()
{
    void CallMethod()
    {
          ASAM_UIManager.Instance.UIState Default();
    }
}