private void OnDestroy() { if (Main == null) { Main = null; } }
public VFXInstantiator Instantiator = new VFXInstantiator(); // Implement you own to instantiate from a pool or similar private void Start() { if (_isMain) { if (Main != null) { Debug.LogError("Duplicate VFXManager marked as main!", Main.gameObject); Destroy(gameObject); } Main = this; } }