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 accepts a single parameter, onClose
, which is a System.Action
delegate. This delegate is invoked when the dialog is closed, allowing for custom actions to be executed upon closure.
Usage
To use the ShowCloseDialog
method, you need to provide a delegate of type System.Action
that defines the actions to be performed when the dialog is closed. This method is typically used in scenarios where you want to ensure that the user confirms the closure of a scene, possibly to prevent accidental data loss.
Example
// Example usage of ShowCloseDialog
Editor.SceneEditorSession.ShowCloseDialog(() => {
// Actions to perform when the dialog is closed
// For example, save changes or log the closure
SaveChanges();
LogClosure();
});
void SaveChanges()
{
// Code to save changes
}
void LogClosure()
{
// Code to log the closure event
}