예제 #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="serializedData">0 - gameobjects, 1 - components</param>
        /// <param name="system"></param>
        /// <param name="serializer"></param>
        public static void Load(string[] serializedData, FullSaveSystem system, fsSerializer serializer)
        {
            SaveLoader.system     = system;
            SaveLoader.serializer = serializer;

            gameobjectsByInstanceID.Clear();
            allGameObjects = new List <GameObject>();

            List <GameObjectData> gameObjects = new List <GameObjectData>();

            serializer.TryDeserialize(fsJsonParser.Parse(serializedData[0]), ref gameObjects);

            // Clean up all existing gos
            SavedGameObject[] targets = GameObject.FindObjectsOfType <SavedGameObject>();
            for (int i = targets.Length - 1; i >= 0; i--)
            {
                GameObject.DestroyImmediate(targets[i].gameObject);
            }

            GameObjectDeserialization(gameObjects);
            ComponentDeserialization(serializedData[1]);
            GameObjectActivation();
        }
예제 #2
0
 private void Awake()
 {
     saveSystem = GetComponent <FullSaveSystem>();
     path       = Application.persistentDataPath + "/test/save.json";
 }