public void SaveGenerated(string gameObjectName) { var gameObject = GameObject.Find(gameObjectName); if (!gameObject) { Debug.LogError($"Save Error! Game object with name '{gameObjectName}' not found"); return; } NamedListOfSerializableVector3 saveData = new NamedListOfSerializableVector3( gameObjectName, new List <SerializableVector3>() ); foreach (Transform child in gameObject.transform) { saveData.List.Add( new SerializableVector3( child.transform.position.x, child.transform.position.y, child.transform.position.z ) ); } SaveGeneratedDataRepository.Save(saveData); }
private void SpawnObjectAtPositionFromLIst(NamedListOfSerializableVector3 list) { GameObject parentGameObject = GreateParentGameObject(PrepareParentObjectName(list.Name)); foreach (var position in list.List) { Instantiate( GetObjectToClone(), position, Quaternion.identity, parentGameObject.transform ); } }