public static void DestroyWithError(GameObject go, string message) { LogSystem.LogWarning(new object[] { message }); if (VCTouchController.Instance != null && VCTouchController.Instance.gameObject == go) { VCTouchController.ResetInstance(); } UnityEngine.Object.Destroy(go); }
/// <summary> /// Outputs an error and then Destroys a GameObject. /// </summary> public static void DestroyWithError(GameObject go, string message) { Debug.LogError(message); // reset our singleton instance for touch controller if this about to be destroyed GO owned it. if (VCTouchController.Instance != null && VCTouchController.Instance.gameObject == go) { VCTouchController.ResetInstance(); } GameObject.Destroy(go); }
private const int kEmulatedTouchFingerId = 99999; // the fingerId we assign to the TouchWrapper that represents Mouse input in the Editor. void Awake() { this.useGUILayout = false; if (Instance != null) { VCUtils.DestroyWithError(gameObject, "Only one VCTouchController can be in a scene! Destroying the gameObject with this component."); return; } Instance = this; touches = new List <VCTouchWrapper>(); // add a TouchWrapper for each touch we will track. We create // and reuse a pool instead of instantiating new touches during execution. for (int i = 0; i < kMaxTouches; i++) { touches.Add(new VCTouchWrapper()); } }
public static void ResetInstance() { Instance = null; }