internal static EntityBase CreateNativeEntity(EntityId id, IntPtr entityPointer) { // check if actor var actorInfo = NativeActorMethods.GetActorInfoById((uint)id._value); if (actorInfo.Id != 0) { return(Actor.CreateNativeActor(actorInfo)); } var nativeEntity = new NativeEntity(id, entityPointer); ScriptManager.Instance.AddScriptInstance(nativeEntity, ScriptType.Entity); return(nativeEntity); }
/// <summary> /// Gets the actor with the specified entity id if it exists. /// </summary> /// <param name="actorId">entityId of the actor you want to obtain</param> /// <returns>Actor if found, null otherwise</returns> public static ActorBase Get(EntityId actorId) { var actor = Get <ActorBase>(actorId); if (actor != null) { return(actor); } // Couldn't find a CryMono entity, check if a non-managed one exists. var actorInfo = NativeActorMethods.GetActorInfoById(actorId); if (actorInfo.Id != 0) { return(CreateNativeActor(actorInfo)); } return(null); }