Description
The LastSelected
property of the Editor.SceneViewportWidget
class provides a reference to the most recently selected SceneViewportWidget
instance. This static property is useful for accessing the last active viewport widget in the editor, allowing developers to perform operations or retrieve information from the last selected viewport without needing to manually track it.
Usage
To access the last selected SceneViewportWidget
, simply use the LastSelected
property. This can be particularly useful in scenarios where you need to apply changes or retrieve data from the viewport that was most recently interacted with by the user.
Example
// Access the last selected SceneViewportWidget
Editor.SceneViewportWidget lastSelectedViewport = Editor.SceneViewportWidget.LastSelected;
if (lastSelectedViewport != null)
{
// Perform operations with the last selected viewport
lastSelectedViewport.ToggleFullscreen();
}