示例#1
0
        protected virtual EcsEntity CreateEntity()
        {
                        #if DEBUG
            startup = GetStartup();
            if (!startup)
            {
                throw new Exception($"There is no {nameof(BaseStartup)} on parents!");
            }
            else if (!startup.worldIsAlive)
            {
                throw new Exception($"{startup.GetType().Name} is not init!");
            }
            else if (!entityValue.IsNull())
            {
                throw new Exception("Entity already created!");
            }
                        #endif

            var newEntity = startup.world.NewEntityWith(out UnityObject unityObject, out NewHybridEntityEvent _);
            unityObject.gameObject = gameObject;
            return(newEntity);
        }
示例#2
0
 private void Awake()
 {
     startup = GetStartup();
 }