public void Init() { // NOTe toffa: we need to copy gameobject or else they will update once stored // as they are stored by ref and not value List <GameObject> SceneGameObjectsTemp = new List <GameObject>(); GetGameObjects(parent, SceneGameObjectsTemp); SceneGameObjects = new GameObject_Save[SceneGameObjectsTemp.Count]; int idx = 0; foreach (GameObject go in SceneGameObjectsTemp) { SceneGameObjects[idx] = new GameObject_Save(go); idx++; } }
public Transform_Save(Transform T) { position = T.position; localPosition = T.localPosition; localRotation = T.localRotation; rotation = T.rotation; localScale = T.localScale; childCount = T.childCount; childs = new GameObject_Save[childCount]; for (int i = 0; i < T.childCount; ++i) { childs[i] = new GameObject_Save(T.GetChild(i).gameObject); } ; }
public override bool Equals(object obj) { GameObject_Save In = obj as GameObject_Save; if (In != null) { bool Result = In.name == this.name && In.transform.Equals(transform) && Components.Count == In.Components.Count; if (Result) { for (int i = 0; i < Components.Count; ++i) { if (!Components[i].Equals(In.Components[i])) { return(false); } } return(Result); } } return(false); }