Forge/Integration/BaseContainer.cs
/// <summary>
/// Constructs a container GameObject for the given entity under the given root object.
/// </summary>
/// <param name="entity">The entity to create a GameObject for</param>
/// <param name="root">The root object to create the GameObject under</param>
/// <returns>The created GameObject.</returns>
Constructs a container GameObject for the given entity under the given root object.
Constructs a container GameObject for the given entity under the given root object .
protected static GameObject CreateGameObject(IQueryableEntity entity, GameObject root) {
            GameObject created = null;
            if (entity.ContainsData<PrefabData>()) {
                string resourcePath = entity.Current<PrefabData>().PrefabResourcePath;
                GameObject prefab = (GameObject)Resources.Load(resourcePath);
                if (prefab == null) {
                    created = new GameObject("");
                    Debug.LogError("Unable to find prefab resource \"" + resourcePath + "\"", created);
                }
                else {
                    created = (GameObject)Instantiate(prefab);
                }
            }
            else {
                created = new GameObject("");
            }
            created.transform.parent = root.transform;
            return created;
        }
protected static GameObject CreateGameObject ( IQueryableEntity entity , GameObject root ) { GameObject created = null ; if ( entity . ContainsData < PrefabData > ( ) ) { string resourcePath = entity . Current < PrefabData > ( ) . PrefabResourcePath ; GameObject prefab = ( GameObject ) Resources . Load ( resourcePath ) ; if ( prefab == null ) { created = new GameObject ( " " ) ; Debug . LogError ( " \" " + resourcePath + " \" " , created ) ; } else { created = ( GameObject ) Instantiate ( prefab ) ; } } else { created = new GameObject ( " " ) ; } created . transform . parent = root . transform ; return created ; }
Constructs a container GameObject for the given entity under the given root object.
Constructs a container GameObject for the given entity under the given root object .
// There is special logic for instantiating an object If the entity contains prefab data // that specifies it should be instantiated from a specific resource, then we load that // resource and clone it instead of creating a new object
The created GameObject.
The created GameObject .
entity
IQueryableEntity
The entity to create a GameObject for
The entity to create a GameObject for
root
GameObject
The root object to create the GameObject under
The root object to create the GameObject under