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. We’re making changes to the Unity Runtime Fee pricing policy that we announced on September 12th. Access our latest thread for more information!
    Dismiss Notice
  3. Dismiss Notice

Bug (Case 1326407) Nested Objects Draw Gizmos twice

Discussion in '2021.2 Beta' started by CDF, Apr 2, 2021.

  1. CDF

    CDF

    Joined:
    Sep 14, 2013
    Posts:
    1,269
    Issue originally reported on 2020.2.3. But exists also in 2021.2

    Nested objects draw gizmos twice when using the DrawGizmo attribute and GizmoType.InSelectionHierarchy type:

    Code (CSharp):
    1. [DrawGizmo(GizmoType.InSelectionHierarchy, typeof(Anchor))]
    2. static void DrawAnchorGizmos(Anchor anchor, GizmoType gizmoType) {
    3.  
    4.     Vector3 position = anchor.transform.position;
    5.  
    6.     Color gizmoColor = Color.blue;
    7.     gizmoColor.a = 0.025f;
    8.  
    9.     using (new Handles.DrawingScope(gizmoColor)) {
    10.  
    11.         Handles.DrawSolidDisc(position, Vector3.forward, anchor.connectionRadius);
    12.     }
    13.  
    14.     gizmoColor = Color.green;
    15.     gizmoColor.a = 0.1f;
    16.  
    17.     using (new Handles.DrawingScope(gizmoColor)) {
    18.  
    19.         Handles.DrawSolidDisc(position, Vector3.forward, anchor.radius);
    20.     }
    21. }
    gizmo-bug.gif

    Unless I'm mistaken, this seems like a bug.
     
  2. LeonhardP

    LeonhardP

    Unity Technologies

    Joined:
    Jul 4, 2016
    Posts:
    3,102
    CDF likes this.
  3. joe_nk

    joe_nk

    Joined:
    Jan 6, 2017
    Posts:
    66
  4. LeonhardP

    LeonhardP

    Unity Technologies

    Joined:
    Jul 4, 2016
    Posts:
    3,102
    Hi @joe_nk,
    So far there were no plans to backport the fix. I've asked the team to consider it for backporting. The status of the backport request will show up on the issue tracker page in a bit.
     
    joe_nk likes this.