예제 #1
0
        /// <summary>
        /// Resets the layout to the currently loaded layout.
        /// </summary>
        public void ResetLayout()
        {
            DespawnAllSelectable();

            SerializableTransforms serializedActiveTransforms = JsonUtility.FromJson <SerializableTransforms>(_currentSave);

            foreach (SerializableTransform st in serializedActiveTransforms._serializableTransforms)
            {
                SpawnSelectable(st._position, st._rotation);
            }
        }
예제 #2
0
        /// <summary>
        /// Saves the layout of spawned selectables.
        /// </summary>
        public void SaveLayout()
        {
            List <Transform> activeTransforms = new List <Transform>();

            foreach (Selectable activeSelectable in _activeSelectables)
            {
                activeTransforms.Add(activeSelectable.transform);
            }

            SerializableTransforms serializedActiveTransforms = new SerializableTransforms(activeTransforms.ToArray());

            _currentSave = JsonUtility.ToJson(serializedActiveTransforms);

            // Write the JSON to a file
        }