private void OnDisable() { if (_Instance == this) { _Instance = null; } }
private void OnEnable() { if ((_Instance == null || _Instance._IsDefaultInstance) && _Instance != this) { if (_Instance != null) { if (Application.isPlaying) { Destroy(_Instance); } else { DestroyImmediate(_Instance); } } _Instance = this; RefreshShaderDefines(); return; } if (_Instance != null && _Instance != this) { Debug.LogWarning("Only one ToonStandardConfiguration allowed at a time. Deleting one of them"); if (Application.isPlaying) { Destroy(this); } else { DestroyImmediate(this); } return; } }