void Awake()
    {
        if (Instance == null)
        {
            Instance = this;
        }
        else if (Instance != this)
        {
            Destroy(gameObject);
        }

        gCaster = GetComponent <GraphicRaycaster> ();

        eSystem = FindObjectOfType <EventSystem> ();
    }
예제 #2
0
    void Awake()
    {
        //Limits instances of this class to this public static "Instance" variable.
        //Use it from other classes to access public methods of this class.
        if (Instance == null)
        {
            Instance = this;
        }
        else if (Instance != this)
        {
            Destroy(gameObject);
            return;
        }

        gCaster = GetComponent <GraphicRaycaster> ();
        eSystem = GetComponent <EventSystem> ();
    }