private void OnDestroy() { if (_current == this) { _current = null; } }
private void Awake() { if (_current != null) { Debug.LogErrorFormat( "Only 1x {0} script may be active at a time. Delete the current {0} script before creating a new one. Aborting.", typeof(ParallaxLayerController).FullName); return; } _current = this; }