- Home /
Event.current.mousePosition only updates on mouse stop?
Hi, I'm making a custom editor script in which I have something following the mouse. I noticed that as long as I'm moving the mouse, the mousePosition event does not update, but when I stop moving the mouse it does which makes my gui object jump in position.
What would you recommend I use to get the mouse position more frequently?
If you figured this out could you post your answer please?
Answer by Bunny83 · Sep 08, 2013 at 09:43 AM
If you want to use the MouseMove event you have to set EditorWindow.wantsMouseMove to true. Keep in mind that events are sent to the active window. For example a SceneViewWindow has it's own events which can be processed in a cursom editors OnSceneGUI callback or with SceneView.onSceneGUIDelegate.
I can't get $$anonymous$$e to work. I've tried:
SceneView.currentDrawingSceneView.wants$$anonymous$$ouse$$anonymous$$ove = true;
and
((SceneView)SceneView.sceneViews[0]).wants$$anonymous$$ouse$$anonymous$$ove = true;
Neither of them make any difference for mouse movement.
@Lukas_G$$anonymous$$C:
Sceneviews already have wants$$anonymous$$ouse$$anonymous$$ove set to true and the $$anonymous$$ouse$$anonymous$$ove event is sent properly to all event handlers which processes sceneview events (either the onSceneGUIDelegate or OnSceneGUI). All other Editor windows have it's own wants$$anonymous$$ouse$$anonymous$$ove variable.
Custom editors (inspectors) don't have the $$anonymous$$ouse$$anonymous$$ove event, only the usual $$anonymous$$ouseDown, $$anonymous$$ouseDrag, $$anonymous$$ouseUp events. $$anonymous$$eep in $$anonymous$$d that controls will "eat" events when they process it. This will change the eventtype to "used" so that no other control can process it.
Without more details about where you want to process which events it's pointless to go any further here. You should post a seperate question.