Skip to content

Commit 2678526

Browse files
committed
add confirm for discarding voxelworld changes on load
1 parent 89d8dd8 commit 2678526

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

Runtime/Code/VoxelWorld/Editor/VoxelWorldEditor.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,14 @@ public override void OnInspectorGUI() {
332332

333333
if (world.voxelWorldFile != null) {
334334
if (GUILayout.Button("Load")) {
335-
Load(world);
335+
if (world.hasUnsavedChanges) {
336+
if (EditorUtility.DisplayDialog("Discarding Changes",
337+
"Are you sure you want to discard unsaved changes to the Voxel World?", "Discard", "Cancel")) {
338+
Load(world);
339+
}
340+
} else {
341+
Load(world);
342+
}
336343
}
337344

338345
if (world.chunks.Count > 0) {

0 commit comments

Comments
 (0)