private void OnSceneGUI(SceneView sceneView) { // perform method only when the mouse is really in the sceneview; the scene view would register other events as well var isMouseInSceneView = new Rect(0, 0, sceneView.position.width, sceneView.position.height).Contains(Event.current.mousePosition); if (!isMouseInSceneView) { return; } this.editorTarget = target as PrefabPainter; if (this.editorTarget == null) { return; } switch (this.editorTarget.mode) { case PrefabPainter.Mode.Brush: brushModule.OnSceneGUI(); break; case PrefabPainter.Mode.Spline: splineModule.OnSceneGUI(); break; case PrefabPainter.Mode.Interaction: interactionModule.OnSceneGUI(); break; case PrefabPainter.Mode.Container: containerModule.OnSceneGUI(); break; } }