public virtual void SaveScene(ProjectItem scene, ProjectManagerCallback callback)
        {
            if (SceneSaving != null)
            {
                SceneSaving(this, new ProjectManagerEventArgs(scene));
            }

            GameObject     extraData = new GameObject();
            ExtraSceneData saveLoad  = extraData.AddComponent <ExtraSceneData>();

            saveLoad.Selection = RuntimeSelection.objects;

            PersistentScene persistentScene = PersistentScene.CreatePersistentScene(
                typeof(SealTeam4.GameManager),
                typeof(SealTeam4.GameManagerAssistant),
                typeof(SealTeam4.RuntimeEditorUltiltes),
                typeof(UnityEngine.Networking.NetworkIdentity)
                );

            if (scene.Internal_Data == null)
            {
                scene.Internal_Data = new ProjectItemData();
            }
            scene.Internal_Data.RawData = m_serializer.Serialize(persistentScene);
            Destroy(extraData);

            m_project.Save(scene, false, saveCompleted =>
            {
                m_project.UnloadData(scene);

                m_activeScene = scene;

                if (callback != null)
                {
                    callback();
                }

                if (SceneSaved != null)
                {
                    SceneSaved(this, new ProjectManagerEventArgs(scene));
                }
            });
        }
Пример #2
0
        public virtual void SaveScene(ProjectItem scene, ProjectManagerCallback callback)
        {
            if (SceneSaving != null)
            {
                SceneSaving(this, new ProjectManagerEventArgs(scene));
            }

            GameObject     extraData = new GameObject();
            ExtraSceneData saveLoad  = extraData.AddComponent <ExtraSceneData>();

            saveLoad.Selection = m_editor.Selection.objects;

            PersistentScene persistentScene = PersistentScene.CreatePersistentScene();

            if (scene.Internal_Data == null)
            {
                scene.Internal_Data = new ProjectItemData();
            }
            scene.Internal_Data.RawData = m_serializer.Serialize(persistentScene);
            Destroy(extraData);

            m_project.Save(scene, false, saveCompleted =>
            {
                m_project.UnloadData(scene);

                m_activeScene = scene;

                if (callback != null)
                {
                    callback();
                }

                if (SceneSaved != null)
                {
                    SceneSaved(this, new ProjectManagerEventArgs(scene));
                }
            });
        }