Esempio n. 1
0
    void Awake()
    {
        if (instance != null && instance != this)
        {
            Destroy(this);
            return;
        }

        instance = this;

        DontDestroyOnLoad(gameObject);
    }
Esempio n. 2
0
    public static KeyCodeCheats GetInstance()
    {
        if (instance == null)
        {
            instance = (KeyCodeCheats)GameObject.FindObjectOfType <KeyCodeCheats>();
            if (instance == null)
            {
                GameObject g = new GameObject("KeyCodeCheats");
                instance = g.AddComponent <KeyCodeCheats>();
            }
        }

        return(instance);
    }