public static void RemoveComponent <T>(this GameObject go) where T : Component { if ((UnityEngine.Object)go == (UnityEngine.Object)null) { return; } T component = go.GetComponent <T>(); if (!(bool)((UnityEngine.Object)component)) { return; } UnityFunction.DestoryObject((UnityEngine.Object)component); }
public static void CreateOrDestroy <T>(this GameObject go, ref T comp, bool isCreate) where T : MonoBehaviour { if (isCreate) { if (!((UnityEngine.Object)comp == (UnityEngine.Object)null)) { return; } comp = go.AddComponent <T>(); } else { if (!(bool)((UnityEngine.Object)comp)) { return; } UnityFunction.DestoryObject((UnityEngine.Object)comp); } }
public static void DestroySelf(this GameObject obj) { UnityFunction.DestroySelf(obj); }
public static void RemoveComponent(this Component comp) { UnityFunction.DestoryObject((UnityEngine.Object)comp); }
public static void RemoveComponent(this GameObject go, System.Type type) { UnityFunction.DestoryObject((UnityEngine.Object)go.GetComponent(type)); }