ECS/Unity/UnityEntityManager.cs
/// <summary>
/// Instantiates only Entities with there Components from Prefab! 
/// Wont Instantiate GameObject itself!
/// Use InstantiateWithGameObject instead.
/// </summary>
Instantiates only Entities with there Components from Prefab.
Wont Instantiate GameObject itself.
Instantiates only Entities with there Components from Prefab . Wont Instantiate GameObject itself .
public void InstantiateWithGameObject(GameObject prefab, NativeArray<Entity> entityArray, NativeArray<GameObject> gameObjectArray) {
            if (gameObjectArray.Length != entityArray.Length) {
                throw new InstantiateGameObjectException("entityArray and gameObjectArray must be the same size");
            }
            for (int i = 0; i < entityArray.Length; i++) {
                entityArray[i] = CreateEntity();
                gameObjectArray[i] = UnityEngine.Object.Instantiate(prefab);
                gameObjectArray[i].GetComponent<GameObjectEntity>().SetEntity(entityArray[i], this);
            }
        }
public void InstantiateWithGameObject ( GameObject prefab , NativeArray < Entity > entityArray , NativeArray < GameObject > gameObjectArray ) { if ( gameObjectArray . Length != entityArray . Length ) { throw new InstantiateGameObjectException ( " " ) ; } for ( int i = 0 ; i < entityArray . Length ; i ++ ) { entityArray [ i ] = CreateEntity ( ) ; gameObjectArray [ i ] = UnityEngine . Object . Instantiate ( prefab ) ; gameObjectArray [ i ] . GetComponent < GameObjectEntity > ( ) . SetEntity ( entityArray [ i ] , this ) ; } }
Instantiates only Entities with there Components from Prefab!
Instantiates only Entities with there Components from Prefab!
prefab
GameObject
entityArray
NativeArray<Entity>
gameObjectArray
NativeArray<GameObject>