Search Issue Tracker
Fixed in 2021.3.49f1
Fixed in 2021.3.X, 2022.3.X, 6000.0.X, 6000.1.X, 6000.2.X, 7000.0.0a18, future release
Votes
0
Found in
2021.3.38f1
2022.3.30f1
6000.0.3f1
6000.1.0a7
6000.2.0a1
Issue ID
UUM-72297
Regression
No
GizmoType.InSelectionHierarchy not detected correctly when NotInSelectionHierarchy is defined
UPDATED: How to reproduce:
1. Open the attached project "GizmosSelectedInHeirachyTests.zip"
2. Open "TestGizmoBehaviourDrawer.cs"
3. Change DrawSelectedGizmosAttempt3 to :
{code:java}
[DrawGizmo(GizmoType.NotInSelectionHierarchy)]
static void DrawSelectedGizmosAttempt3(TestGizmoBehaviour target, GizmoType gizmoType)
{
DrawGizmosInternal(target);
}
{code}
4. Open Assets/GizmoTest/Scenes/SampleScene.unity
5. Select "Main Camera" or "Directional Light"
Expected results: Gizmos are drawn for TestTarget
Actual results: Gizmo for TestTarget is not drawn. Reparenting TestParent under camera and then selecting light will start drawing the cube. So it sometimes works correctly but not always.
Reproducible with: 2021.3.38f1, 2022.3.30f1, 6000.0.3f1
Reproducible on: Windows 10 22H2, MacOS Sonoma 14.4.1 M1
Not reproducible on: ?
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Sprites lose their reference in Scene and Game view when changing Texture2D Import Settings
- “Assemblies” and “Areas” tabs disappears after switching to Scene tab and back in the Assemblies filter window
- Huge memory allocations when TMP dynamically adds glyphs from AssetBundle fonts
- “Redefinition of 'LOD_FADE_CROSSFADE'" shader errors thrown when opening SpeedTree9_URP.shadergraph in Universal 3D Template
- NullReferenceException is thrown and the window is broken when opening the "Active Scenario" window in Multiplayer Center
Resolution Note (fix version 2021.3.49f1):
Issue does not reproduce if user's custom state/code is removed. If we take the user's code and comment most of it out and just leave the below in TargetOutlineGizmosDrawer:
[DrawGizmo(GizmoType.Selected | GizmoType.InSelectionHierarchy)]
static void DrawSelectedGizmosAttempt3(TestGizmoBehaviour target, GizmoType gizmoType)
{
Gizmos.DrawCube(target.transform.position, Vector3.one);
}
The cube is drawn when TestTarget is directly selected or its ascendants.
If we modify the GrawGizmo attribute to:
[DrawGizmo(GizmoType.Selected], then it's drawn only when TestTarget is directly selected.
If we modify the GrawGizmo attribute to:
[DrawGizmo(GizmoType.InSelectionHierarchy], then it's drawn when TestTarget is within the hierarchy of current selection.
This is the expected behaviour and was tested with 2022.3.2f, 6000.0.3f, 6000.0.5f.
Recommendation for user is to validate this behaviour by first removing the custom state/flags from their code.
Resolution Note (fix version 7000.0.0a18):
Issue does not reproduce if user's custom state/code is removed. If we take the user's code and comment most of it out and just leave the below in TargetOutlineGizmosDrawer:
[DrawGizmo(GizmoType.Selected | GizmoType.InSelectionHierarchy)]
static void DrawSelectedGizmosAttempt3(TestGizmoBehaviour target, GizmoType gizmoType)
{
Gizmos.DrawCube(target.transform.position, Vector3.one);
}
The cube is drawn when TestTarget is directly selected or its ascendants.
If we modify the GrawGizmo attribute to:
[DrawGizmo(GizmoType.Selected], then it's drawn only when TestTarget is directly selected.
If we modify the GrawGizmo attribute to:
[DrawGizmo(GizmoType.InSelectionHierarchy], then it's drawn when TestTarget is within the hierarchy of current selection.
This is the expected behaviour and was tested with 2022.3.2f, 6000.0.3f, 6000.0.5f.
Recommendation for user is to validate this behaviour by first removing the custom state/flags from their code.