void Awake() { if (_instance == null) { _instance = this; } else if (_instance != this) { Destroy(this.gameObject); } }
public static void Spawn() { _instance = FindObjectOfType <MouseControls>(); if (_instance == null) { return; } var GO = new GameObject("Mouse Trail"); GO.transform.SetParent(Tower.Player.transform.parent); _instance = GO.AddComponent <MouseControls>(); }