private void LoadEntitySuccessCallback(string entityAssetName, object entityAsset, float duration, object userData) { //获取记载实体的信息 LoadEntityInfo loadEntityInfo = (LoadEntityInfo)userData; if (loadEntityInfo == null) { Debug.LogError("加载实体的信息为空"); return; } m_EntitiesBeingLoaded.Remove(loadEntityInfo.EntityId); if (m_EntitiesToReleaseOnLoad.Contains(loadEntityInfo.SerialId)) { Debug.LogError(string.Format("需要释放的实体:{0}(id:{1})加载成功", loadEntityInfo.EntityId.ToString(), loadEntityInfo.SerialId.ToString())); m_EntitiesToReleaseOnLoad.Remove(loadEntityInfo.SerialId); m_EntityHelper.ReleaseEntity(entityAsset, null); return; } //实例化实体,并将实体实例对象放入对象池 EntityInstanceObject entityInstanceObject = new EntityInstanceObject(entityAssetName, entityAsset, m_EntityHelper.InstantiateEntity(entityAsset), m_EntityHelper); loadEntityInfo.EntityGroup.RegisterEntityInstanceObject(entityInstanceObject, true); //显示实体 ShowEntity(loadEntityInfo.EntityId, entityAssetName, loadEntityInfo.EntityGroup, entityInstanceObject.Target, true, duration, loadEntityInfo.UserData); }
public override void Release() { m_EntityHelper.ReleaseEntity(m_EntityAsset, Target); }