protected virtual bool Init(ActDetectorBase instance, string detectorName) { if (Object.op_Inequality((Object)instance, (Object)null) && Object.op_Inequality((Object)instance, (Object)this) && instance.keepAlive) { Object.Destroy((Object)this); return(false); } Object.DontDestroyOnLoad((Object)((Component)this).get_gameObject()); return(true); }
private static void DestroyDetectorImmediate(ActDetectorBase component) { if (component.transform.childCount == 0 && component.GetComponentsInChildren <Component>(true).Length <= 2) { DestroyImmediate(component.gameObject); } else { DestroyImmediate(component); } }
protected virtual bool Init(ActDetectorBase instance, string detectorName) { if (instance != null && instance != this && instance.keepAlive) { Destroy(this); return(false); } DontDestroyOnLoad(gameObject); return(true); }
protected virtual bool Init(ActDetectorBase instance, string detectorName) { if (instance != null && instance != this && instance.keepAlive) { Debug.LogWarning(ACTkConstants.LogPrefix + name + ": self-destroying, other instance already exists & only one instance allowed!", gameObject); Destroy(this); return(false); } DontDestroyOnLoad(gameObject); return(true); }
protected virtual bool Init(ActDetectorBase instance, string detectorName) { if (instance != null && instance != this && instance.keepAlive) { if (GameData.gSteam) { Debug.LogWarning("[ACTk] " + base.name + ": self-destroying, other instance already exists & only one instance allowed!", base.gameObject); } UnityEngine.Object.Destroy(this); return(false); } UnityEngine.Object.DontDestroyOnLoad(base.gameObject); return(true); }
protected virtual bool Init(ActDetectorBase instance, string detectorName) { if (instance != null && instance != this && instance.keepAlive) { Destroy(this); return(false); } /*if (!IsPlacedCorrectly(detectorName)) * { * Debug.LogWarning("[ACTk] " + detectorName + " is placed in scene incorrectly and will be auto-destroyed!\nPlease, use \"" + MENU_PATH.Replace("/", "->") + detectorName + "\" menu to correct this!"); * Destroy(gameObject); * return false; * }*/ DontDestroyOnLoad(gameObject); return(true); }
protected virtual bool Init(ActDetectorBase instance, string detectorName) { if (instance != null) { Debug.LogWarning("[ACT] Only one " + detectorName + " instance allowed!"); Destroy(gameObject); return(false); } if (!IsPlacedCorrectly(detectorName)) { Debug.LogWarning("[ACT] " + detectorName + " is placed in scene incorrectly and will be auto-destroyed!\nPlease, use \"" + MENU_PATH.Replace("/", "->") + detectorName + "\" menu to correct this!"); Destroy(gameObject); return(false); } DontDestroyOnLoad(gameObject); return(true); }