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); }
public SceneReferenceItem(IPersistenceManager persistenceManager, Guid sceneGuid, bool isStartup) { m_PersistenceManager = persistenceManager; IsStartup = isStartup; SceneGuid = sceneGuid; ScenePath = m_PersistenceManager.GetSceneAssetPath(SceneGuid); }
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); }