Skip to main content

OnSceneGUI In Editor Window

This is how you can get OnSceneGUI features like Handles to work on EditorWindows.

Unity_5HY3oXTJJj.png

private void OnEnable()
{
  	// Ensure that there is no delegate callback
  	SceneView.duringSceneGui -= OnSceneGUI;
  
  	// Define the callback for the delegate
  	SceneView.duringSceneGui += OnSceneGUI;
}

private void OnDestroy()
{
  	// After the editor window is destroyed, remove the callback
  	SceneView.duringSceneGui -= OnSceneGUI;
}

private void OnSceneGUI(SceneView sceneView)
{
	// Here you can use OnSceneGUI features like Handles
}