x


What is the easiest way to get mouse move events in inspectors?

I want to implement my own simplistic atlas editor in the inspector window. How do I get the relevant mouse move events?

There seems to be a property called EditorWindow.wantsMouseMove, but I don't know how to set this for my particular inspector view.

http://forum.unity3d.com/threads/134399-What-is-the-easiest-way-to-get-mouse-move-events-in-inspectors

more ▼

asked Apr 30 '12 at 01:10 PM

steinbitglis gravatar image

steinbitglis
384 14 17 23

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

You can't set wantsMouseMove in Editors since it's a property of EditorWindow. The whole editor is usually completly event driven. However mousemove events seems to not trigger the OnGUI / OnInspectorGUI callback, probably for performance reasons.

For what reason do you need mousemove events? Mousedrag-events are usually generated in all kind of windows. Also do you talk about mousemove events in the custom editor (inspector) itself, or in the scene view like the terrain editor?

The Terrain editor for example uses OnInspectorUpdate to repaint the whole inspector window when neccessary.

private void OnInspectorUpdate()
{
    if (EditorUtility.hasAnyNewPreviewTexturesAvailable)
    {
        base.Repaint();
    }
}

There are many ways to react to certain events.

more ▼

answered Apr 30 '12 at 02:19 PM

Bunny83 gravatar image

Bunny83
67.2k 22 68 269

I want to highlight the sprite within the atlas on mouseover, that is why I want to use the mousemove event. At the moment I do not know how implement highlighting either, but I'm working on it. I am using GUI.DrawTexture to display the atlas.

Apr 30 '12 at 02:27 PM steinbitglis
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x692
x28

asked: Apr 30 '12 at 01:10 PM

Seen: 1352 times

Last Updated: May 01 '12 at 05:22 PM