public void OnDestroy() { StaticBatching batching = StaticBatching.GetInstanceOnDestroy(); if (!Essentials.UnityIsNull(batching)) { batching.DestroyVisualRepresentations(this); } }
/// <summary> /// Enforces the singleton pattern. /// </summary> private void Awake() { if (Essentials.UnityIsNull(_instance)) { _instance = this; } else { Debug.LogError("Singleton pattern violated! Destroying StaticBatching!", this.gameObject); Destroy(this); } }