Exemple #1
0
        /// <summary>
        /// Removes the entity with the specified id.
        /// </summary>
        /// <param name="id"></param>
        /// <param name="forceRemoveNow"></param>
        public static void Remove(EntityId id, bool forceRemoveNow = false)
        {
#if !(RELEASE && RELEASE_DISABLE_CHECKS)
            if (id == 0)
            {
                throw new ArgumentException("entityId cannot be 0!");
            }
#endif
            if (!NativeEntityMethods.GetFlags(NativeEntityMethods.GetEntity(id)).HasFlag(EntityFlags.NoSave))
            {
                throw new EntityRemovalException("Attempted to remove an entity placed via Editor");
            }

            NativeEntityMethods.RemoveEntity(id, forceRemoveNow);
        }