- Home /
DrawGizmo attribute: GizmoType arg with incompatible flag values
Hello there,
I try to use the `DrawGizmo` attribute to draw custom gizmos for my personal Unity editor tool.
The documentation about DrawGizmo
is a bit sparse: I couldn't make the second DrawGizmo
prototype work (`static function DrawGizmo (gizmo : GizmoType, drawnGizmoType : Type) : DrawGizmo`), so I'm using the first version of DrawGizmo
but I've encountered some troubles about the values of the GizmoType
argument.
In the C#
example below, I've specifed the gizmo draw callback to be called when a Light
game object is selected... but it appears to be executed whatever the object is selected or not! The GizmoType
arg have sometimes all its flags enabled (`Active|NotSelected|Selected|SelectedOrChild`): how a game object can be active, selected and not selected at the same time?
[DrawGizmo( GizmoType.Selected )]
private static void RenderCustomLightGizmo( Light a_rLight, GizmoType a_eGizmoType )
{
Gizmos.DrawSphere( a_rLight.transform.position, 3.0f );
if( ( a_eGizmoType & GizmoType.NotSelected ) != 0 )
{
Handles.Label( a_rLight.transform.position,
a_rLight.name + " is selected but GizmoType says it is not. This message should not appear." );
}
}
Is it an Unity bug or am I doing/understanding something wrong?
Thanks.
PS: I was forgetting, I'm using Unity 3.5.7 on OSX 10.8.2
It seems that value of a_eGizmoType is multiplied by 2. I just submitted a bug report for this issue (Case 680232).