예제 #1
0
 static public void ensureInstance()
 {
     if (!HasInstance)
     {
         mInstance = loadFromStreamingAssets();
         mInstance.forceSetCurrentScene();
     }
 }
예제 #2
0
        /// <summary>
        /// Creates a new SceneManager and serializes it directly.
        /// </summary>
        /// <param name="scenes">A List of Scenes. The Scenes path has to be relative to the Assets/ directory</param>
        /// <param name="final">If true, the serilization will try to minimize the serialized file</param>
        static public void saveToStreamingAssets(Scene[] scenes, bool final)
        {
            SceneManager manager = new SceneManager();

            foreach (Scene scene in scenes)
            {
                manager.mScenes.Add(scene.Path, scene);
            }

            Directory.CreateDirectory(Path.GetDirectoryName(getFilePath()));
            string json = JsonConvert.SerializeObject(manager, ((final)?Formatting.None : Formatting.Indented));
            File.WriteAllText(getFilePath(), json);
        }