Description
The ShowCloseDialog
method is a static method of the SceneEditorSession
class within the Editor
namespace. This method is used to display a dialog that prompts the user to confirm the closure of the current scene. It is particularly useful when there are unsaved changes that the user might want to save before closing the scene.
Usage
To use the ShowCloseDialog
method, you need to provide a callback function of type System.Action
as a parameter. This callback will be executed once the dialog is closed, allowing you to handle any post-dialog logic, such as saving changes or cleaning up resources.
Example
// Example usage of ShowCloseDialog
Editor.SceneEditorSession.ShowCloseDialog(() => {
// Logic to execute after the dialog is closed
// For example, save changes or close the scene
SaveChanges();
CloseScene();
});
void SaveChanges()
{
// Implement save logic here
}
void CloseScene()
{
// Implement scene closing logic here
}