/// <summary> /// Get an entity by its unique ID. /// </summary> /// <param name="entityId"> The ID as an unsigned integer. </param> /// <returns> A reference to the entity. </returns> /// <remarks> /// If the entity does not exist in the managed space, this function will attempt to find a /// C++ entity with the specified ID> /// </remarks> public static EntityBase Get(EntityId entityId) { #if !(RELEASE && RELEASE_DISABLE_CHECKS) if (entityId == 0) { throw new ArgumentException("entityId cannot be 0!"); } #endif var ent = Get <EntityBase>(entityId); if (ent != null) { return(ent); } // Couldn't find a CryMono entity, check if a non-managed one exists. var entPointer = EntityInterop.GetEntity(entityId); if (entPointer != IntPtr.Zero) { return(CreateNativeEntity(entityId, entPointer)); } return(null); }