public static IEnumerable <TObjectType> GetEntities <TObjectType>() where TObjectType : Entity, new() { List <TObjectType> list = new List <TObjectType>(); IntPtr entityPtr = IntPtr.Zero; do { entityPtr = EntitySystem.NextEnt(entityPtr); if (entityPtr == IntPtr.Zero) { continue; } Entity getEntity = CacheObject.Instance.CreateGet(entityPtr); if (getEntity is TObjectType type) { list.Add(type); } } while (entityPtr != IntPtr.Zero); return(list); }