コード例 #1
0
        public void UnloadSceneWithDialog(Scene scene)
        {
            if (IsSceneChanged(scene))
            {
                var dialogResult = EditorUtility.DisplayDialogComplex(
                    $"Save Scene",
                    $"There are unsaved changes in the Scene, do you want to save?",
                    "Yes",
                    "No",
                    "Cancel");

                switch (dialogResult)
                {
                case 0:
                    // Yes: Save and continue closing the project
                    var assetPath = m_Persistence.GetSceneAssetPath(scene);
                    if (!string.IsNullOrEmpty(assetPath))
                    {
                        m_Persistence.SaveScene(m_WorldManager.EntityManager, scene, assetPath);
                    }
                    break;

                case 1:
                    // No: Don't save and continue closing the project
                    break;

                case 2:
                    // Cancel: Opt out, the user has canceled the operation
                    return;
                }
            }
            UnloadScene(scene);
        }
コード例 #2
0
            public SceneReferenceItem(IPersistenceManager persistenceManager, Guid sceneGuid, bool isStartup)
            {
                m_PersistenceManager = persistenceManager;

                IsStartup = isStartup;
                SceneGuid = sceneGuid;
                ScenePath = m_PersistenceManager.GetSceneAssetPath(SceneGuid);
            }
コード例 #3
0
        public void Update(InspectorDataProxy <SceneReference> proxy)
        {
            var sceneReference = proxy.Data;
            var assetPath      = m_PersistenceManager.GetSceneAssetPath(sceneReference.SceneGuid);
            var sceneAsset     = UnityEditor.AssetDatabase.LoadAssetAtPath <SceneAsset>(assetPath);

            m_ObjectField.SetValueWithoutNotify(sceneAsset);
        }