- Home /
Permanent handles (when object is not selected)
Hey all,
I tried to make an editor extension which shows a transform handle even when the object isn't selected. Interestingly, this is easily done by using Handles.PositionHandle from inside a OnDrawGizmos method on a GameObject. But using this approach, the handles can't beclicked or moved - they only show.
Is there a way to accomplish this? This would allow for things like the light handles being usable without clicking each light (which could, of course, visually clutter the scene).
Answer by SirIntruder · Aug 31, 2013 at 05:07 PM
I was digging through the internet to find solution for this, and here it is: in custom inspector, add handle-drawing function to SceneView.OnSceneGUIDelgate. Something like this:
private void OnScene(SceneView sceneview)
{
// draw handles
}
void OnEnable()
{
SceneView.onSceneGUIDelegate -= OnScene;
SceneView.onSceneGUIDelegate += OnScene;
}
Now OnScene method is called with each sceneGUI event, whether or not gameObject is selected, and Handles are enabled and movable.
btw - if handles don't move in OnScene(SceneView), try simply calling OnSceneGUI() from OnScene(SceneView) (you still need OnScene, for this delegate passes SceneView as an argument).
So, I would have to implementcustom handle drawing AND move logic this way? I thought more of drawing the built-in ones somehow.
This solution no longer works unfortunately. You have to roll your own.
Your answer
Follow this Question
Related Questions
Mouse click in edit mode. ✱✺✸❁ 1 Answer
Custom Transform Editor in Scene Editor 2 Answers
Draggable Nodes in Editor? 1 Answer
box gizmo with scale handles 0 Answers
The name 'Joystick' does not denote a valid type ('not found') 2 Answers