Search Unity

Unity gizmos not clickable

Discussion in 'Scripting' started by seth_illgard, May 9, 2009.

  1. seth_illgard

    seth_illgard

    Joined:
    Jul 22, 2008
    Posts:
    11
    Hello. I have a simple script that reads like this:

    Code (csharp):
    1.  
    2. using UnityEngine;
    3. using System.Collections;
    4.  
    5. [ExecuteInEditMode()]
    6. public class CRailNode : MonoBehaviour
    7. {
    8.     void OnDrawGizmos()
    9.     {
    10.         Gizmos.color = Color.yellow;
    11.         Gizmos.DrawSphere(transform.position, 0.5f);
    12.     }
    13.  
    14.     void OnDrawGizmosSelected()
    15.     {
    16.         Gizmos.color = Color.red;
    17.         Gizmos.DrawSphere(transform.position, 0.5f);
    18.     }
    19. }
    20.  
    The problem with that is that the gizmos are NOT clickable. I can select them using the hierarchy window and then they have the expected behavior(they turn red) but I canot click on them.

    Any ideas? I'm running Unity 2.5 on Vista 64.
     
  2. seth_illgard

    seth_illgard

    Joined:
    Jul 22, 2008
    Posts:
    11
    Just a little bump :p
     
  3. Tempest

    Tempest

    Joined:
    Dec 10, 2008
    Posts:
    1,286
    Drawing Gizmos don't create a clickable region. They don't add actual volume (if you could call it that) to your GameObject. If you want something which could be clickable, try GameObject->Create Other->Sphere.

    That'll give you something which you could click in Editor to select.
     
  4. MatthewW

    MatthewW

    Joined:
    Nov 30, 2006
    Posts:
    1,356
    They did in 2.1. This is a 2.5 regression. See the Gizmos docs.

     
  5. Tempest

    Tempest

    Joined:
    Dec 10, 2008
    Posts:
    1,286
    Interesting. I stand corrected. :)
     
  6. seth_illgard

    seth_illgard

    Joined:
    Jul 22, 2008
    Posts:
    11
    Thanks. So there is no solution right away so I think I need to create geometry :(

    I'll add this a feature requests:

    *Ability to create clickable gizmos
    *Ability to create gizmos that hide behind 3d geometry