ECS/Unity/UnityEntityManager.cs
/// <summary>
/// Instantiates only Entity with it's Components from Prefab! 
/// Wont Instantiate GameObject itself!
/// Use InstantiateWithGameObject instead.
/// </summary>
Instantiates only Entity with it's Components from Prefab.
Wont Instantiate GameObject itself.
Instantiates only Entity with it ' s Components from Prefab . Wont Instantiate GameObject itself .
public Entity Instantiate(GameObject prefab) {
            var gameObjectEntity = prefab.GetComponent<GameObjectEntity>();
            if (!gameObjectEntity) {
                throw new Exception(prefab.name + " cant be instantiate without " + typeof(GameObjectEntity).Name + " component");
            }
            Entity entity = CreateEntity();
            ComponentWrapper[] components = gameObjectEntity.GetComponents();
            for (int i = 0; i < components.Length; i++) {
                components[i].AddComponentToEntity(entity, this);
            }
            return entity;
        }
public Entity Instantiate ( GameObject prefab ) { var gameObjectEntity = prefab . GetComponent < GameObjectEntity > ( ) ; if ( ! gameObjectEntity ) { throw new Exception ( prefab . name + " " + typeof ( GameObjectEntity ) . Name + " " ) ; } Entity entity = CreateEntity ( ) ; ComponentWrapper [ ] components = gameObjectEntity . GetComponents ( ) ; for ( int i = 0 ; i < components . Length ; i ++ ) { components [ i ] . AddComponentToEntity ( entity , this ) ; } return entity ; }
Instantiates only Entity with it's Components from Prefab!
Instantiates only Entity with it ' s Components from Prefab!
prefab
GameObject