- Home /
Custom Editor : simple example required c#
I'd appreciate it if someone could show me how to create a custom editor that will display the mouse position in the inspector when the left mouse button is released in the Scene View.
I've tried for an hour or so but I must be missing something.
Thanks for any help.
Answer by yoyo · Apr 27, 2011 at 10:50 PM
This works to catch mouse down. Mouse up doesn't come through though -- looks like the scene view already swallowed it. I do get mouse up for the right button though, if that helps.
using UnityEngine; using UnityEditor;
[CustomEditor(typeof(Transform))] public class EditorTempTest : Editor { void OnSceneGUI() { if (Event.current.type == EventType.MouseDown) { Debug.Log(Event.current.mousePosition); } } }
Your answer
Follow this Question
Related Questions
Locking the mouse cursor when orbiting camera in Unity Editor 0 Answers
How can I stop the middle mouse button from zooming out when I single click it inside the editor? 2 Answers
In the Editor, how do you detect a mouse-click without using a collider? 1 Answer
Correct behavior of the mouse wheel when zooming in a 2D area (Unity Editor) 0 Answers