/// <summary> /// creates the gameobject and scripts (which values are not loaded yet). /// this is called recursiv for all children of this game object /// </summary> public GameObject createObject(Transform parent, int siblingIndex = -1) { GameObject gameObject; gameObject = getSceneGameObject(parent); BaseSaveableGameObject saveableObject = gameObject.GetComponent <BaseSaveableGameObject>(); inGameObject = gameObject; gameObject.SetActive(active); gameObject.tag = tag; gameObject.transform.parent = parent; gameObject.layer = layer; gameObject.name = gameObjectName; if (siblingIndex >= 0) { gameObject.transform.SetSiblingIndex(siblingIndex); } reconstructAttachedComponentList(saveableObject); foreach (TreeNode <IRestorableGameObject> node in childTree.getAllNodesWithValues()) { node.Value.createObject( SaveableScene.getTransformFromPath( gameObject.transform, node.getParentTreePath()) , node.Key); } return(gameObject); }
public override void prepareGameObjectRestore(IList <Transform> nonPrefabs) { InGameObject = SaveableScene.getTransformFromPath(pathFromRoot).gameObject; SaveableNonPrefab saveableNonPrefab = InGameObject.GetComponent <SaveableNonPrefab>(); saveableNonPrefab.PathFromRoot = pathFromRoot; nonPrefabs.Add(InGameObject.transform); }