protected override void OnDestroy() { if (_instance == this) { _instance = null; } }
protected override void Awake() { base.Awake(); //Debug.Log("Instancing as child of: " + transform.parent + " as part of go " + gameObject.name); if (_instance != null) { Debug.LogWarning("Trying to instantiate multiple UILaserInputModule."); DestroyImmediate(this.gameObject); } _instance = this; StandaloneInputModule sim = GetComponent <StandaloneInputModule> (); if (sim != null) { Destroy(sim); } }