- Home /
How to disable the default transform gizmo in editor?
I have put together a simple tool to build a basic mesh right in the editor by defining a series of points. The points can be tweaked via Editor.OnSceneGUI() and Handles.Slider2D(). However, the default transform gizmo is still there and gets in the way -- it often "steals" the mouse input when I'm trying to click on a custom gizmo that's just under it.
This snippet, placed inside of OnSceneGUI(), successfully prevents the default transform gizmo from being painted:
if(Event.current.type == EventType.Layout ||
Event.current.type == EventType.Repaint) {
Event.current.Use();
}
However, it also prevents the drawing of the scene view widget (in the top right corner), which seems slightly less than ideal. I feel that there must be an option (or a more selective filter on Event.current) that I could filter for that would do what I'm looking for, but my Google-fu is failing me today.
Answer by MSylvia · Dec 19, 2013 at 04:31 PM
Know this is a little old but incase anyone else stumbles across this issue.
In your editor class:
Tool lastTool = Tool.None;
void OnEnable()
{
lastTool = Tools.current;
Tools.current = Tool.None;
}
void OnDisable()
{
Tools.current = lastTool;
}
And probably in your OnSceneGUI
Tools.current = Tool.None;
This doesn't work if you want to use the tools for other things. For example, I want to move and rotate some custom handles inside of the object but the object itself isn't going to move or rotate so I want to hide the default.
This is useful information thank you, also your tip can be applied easily in the OnSceneGUI event so I'm unsure why you were down-voted originally
Dude! Thanks. I've had my own movement handles drawn in a CustomProperty, so I had to hide current tool to draw my own editor for that property.