• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
2
Question by fherbst · Nov 13, 2011 at 07:54 PM · editorgizmohandlesondrawgizmos

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).

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
3

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).

Comment
Add comment · Show 3 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image fherbst · Aug 31, 2013 at 05:48 PM 0
Share

So, I would have to implementcustom handle drawing AND move logic this way? I thought more of drawing the built-in ones somehow.

avatar image Mrkelly · Dec 06, 2013 at 03:21 AM 0
Share

that's good! thank you!

avatar image projectskillz · Apr 18, 2014 at 03:38 AM 1
Share

This solution no longer works unfortunately. You have to roll your own.

Your answer

Hint: You can notify a user about this post by typing @username

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

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Select object by selecting gizmo or handle? 1 Answer

Handles.matrix seems strange? 2 Answers

Is there a way to draw a custom image to a handle in a custom editor like you can for gizmos? 1 Answer

Editor Scripting - Override Scaling 1 Answer

Refreshing Editor Scripts 1 Answer

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges