Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Editor: Override drawing of default object handles

Discussion in 'Scripting' started by A.Killingbeck, May 27, 2014.

  1. A.Killingbeck

    A.Killingbeck

    Joined:
    Feb 21, 2014
    Posts:
    483
    Hello, I'm writing a custom editor. I have some custom handles which are drawn when a specific gameobject is selected. However, I would like to remove the default handles for that gameobject that unity gives, to remove the clutter and make selecting my tools easier. Is there a function which deals with drawing gizmos which I can override?

    Thanks
     
  2. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,716
    No method to override, but you can manually set the current selected tool to none.

    Example of a property in my spline editor;

    Code (csharp):
    1.  
    2.         private bool Active
    3.         {
    4.             get { return active; }
    5.             set
    6.             {
    7.                 if (active != value)
    8.                 {
    9.                     active = value;
    10.  
    11.                     if (active)
    12.                     {
    13.                         lastTool = Tools.current;
    14.                         Tools.current = Tool.None;
    15.                     }
    16.                     else
    17.                     {
    18.                         Tools.current = lastTool;
    19.                     }
    20.                 }
    21.             }
    22.         }
    23.  
     
  3. A.Killingbeck

    A.Killingbeck

    Joined:
    Feb 21, 2014
    Posts:
    483

    That's great, thanks!