public void RemoveEntityProcessor <T>() where T : ComponentSystemBase { InterfaceUtilities.RemoveInterfaceImplementationsOfTypeFromList(typeof(T), ref processors); foreach (GeometryVision geoVision in geoVisions) { var system = geoVision.EntityWorld.GetExistingSystem <T>(); if (system != null) { geoVision.EntityWorld.DestroySystem(system); } } }
/// <summary> /// Use this to remove eye game object or entity implementation. /// Also handles removing the MonoBehaviour component if the implementation is one /// </summary> /// <typeparam name="T"></typeparam> public void RemoveEntityEye <T>() where T : ComponentSystemBase { // Currently only one system var eye = GetEye <GeometryVisionEntityEye>(); if (eye != null) { InterfaceUtilities.RemoveInterfaceImplementationsOfTypeFromList(typeof(T), ref eyes); } var system = EntityWorld.GetExistingSystem <T>(); if (system != null) { EntityWorld.DestroySystem(system); } }
/// <summary> /// Use this to remove eye game object or entity implementation. /// Also handles removing the MonoBehaviour component if the implementation is one /// </summary> /// <typeparam name="T"></typeparam> public void RemoveEye <T>() { InterfaceUtilities.RemoveInterfaceImplementationsOfTypeFromList(typeof(T), ref eyes); if (typeof(T) == typeof(GeometryVisionEye)) { var eye = GetComponent <GeometryVisionEye>(); //also remove the mono behaviour from gameObject, if it is one. TODO: get the if implements monobehaviour //Currently there is only 2 types. Other one is MonoBehaviour and the other one not if (Application.isPlaying && eye != null) { Destroy(eye); } else if (Application.isPlaying == false && eye != null) { DestroyImmediate(eye); } } }