浏览代码

DrawSceneEditor now has a single, non-branching undo check

This was done to balance out undo calls when no scene is selected from scene picker
/main
Carlos Eduardo Pérez 4 年前
当前提交
f6215f53
共有 1 个文件被更改,包括 9 次插入10 次删除
  1. 19
      UOP1_Project/Assets/Scripts/Editor/GameSceneEditor.cs

19
UOP1_Project/Assets/Scripts/Editor/GameSceneEditor.cs


var sceneName = gameSceneTarget.sceneName;
EditorGUI.BeginChangeCheck();
var selectedScene = sceneList.ToList().IndexOf(sceneName);
selectedScene = EditorGUILayout.Popup("Scene", selectedScene, sceneList);
if (selectedScene > -1)
if (selectedScene < 0)
if (EditorGUI.EndChangeCheck())
{
Undo.RecordObject(target, "Changed selected scene");
gameSceneTarget.sceneName = sceneList[selectedScene];
MarkAllDirty();
}
EditorGUILayout.HelpBox(noScenesWarning, MessageType.Warning);
else
selectedScene = EditorGUILayout.Popup("Scene", selectedScene, sceneList);
if (EditorGUI.EndChangeCheck())
EditorGUILayout.HelpBox(noScenesWarning, MessageType.Warning);
Undo.RecordObject(target, "Changed selected scene");
gameSceneTarget.sceneName = sceneList[selectedScene];
MarkAllDirty();
}
}

正在加载...
取消
保存