Skip to content

Commit fe4e348

Browse files
authored
Merge pull request #393 from Unity-Technologies/v4.5/backport-1332226-missing-gizmos-menu-items
[Backport] Fix for missing Gizmos Menu items for projects that have ProBuilder installed
2 parents 3766741 + a72f468 commit fe4e348

File tree

2 files changed

+18
-8
lines changed

2 files changed

+18
-8
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
66
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
77

8+
## [Unreleased]
9+
10+
### Bug Fixes
11+
12+
- [case: 1332226] Fixed issue where some Gizmos menu items would be missing in projects that have ProBuilder package installed.
13+
814
## [4.5.1] - 2021-02-04
915

1016
### Bug Fixes

Editor/EditorCore/HierarchyListener.cs

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,7 @@ static class HierarchyListener
1212
{
1313
static HierarchyListener()
1414
{
15-
// The inspector icon for ProBuilderMesh is set in the component metadata. However, this also serves as the
16-
// scene view gizmo icon, which we do not want. To avoid drawing an icon for every mesh in the Scene View,
17-
// we simply tell the AnnotationManager to not render the icon. This _does_ put ProBuilderMesh in the
18-
// "Recently Changed" list, but only when it is modified the first time.
19-
// The alternative method of setting an icon is to place it in a folder named "Editor Default Resources/Icons",
20-
// however that requires that the resources directory be in "Assets", which we do not want to do.
21-
EditorUtility.SetGizmoIconEnabled(typeof(ProBuilderMesh), false);
22-
15+
AssemblyReloadEvents.afterAssemblyReload += OnAfterAssemblyReload;
2316
// When a prefab is updated, this is raised. For some reason it's
2417
// called twice?
2518
#if UNITY_2018_1_OR_NEWER
@@ -33,6 +26,17 @@ static HierarchyListener()
3326
PrefabUtility.prefabInstanceUpdated += PrefabInstanceUpdated;
3427
}
3528

29+
static void OnAfterAssemblyReload()
30+
{
31+
// The inspector icon for ProBuilderMesh is set in the component metadata. However, this also serves as the
32+
// scene view gizmo icon, which we do not want. To avoid drawing an icon for every mesh in the Scene View,
33+
// we simply tell the AnnotationManager to not render the icon. This _does_ put ProBuilderMesh in the
34+
// "Recently Changed" list, but only when it is modified the first time.
35+
// The alternative method of setting an icon is to place it in a folder named "Editor Default Resources/Icons",
36+
// however that requires that the resources directory be in "Assets", which we do not want to do.
37+
EditorApplication.delayCall += () => EditorUtility.SetGizmoIconEnabled(typeof(ProBuilderMesh), false);
38+
}
39+
3640
static void PrefabInstanceUpdated(GameObject go)
3741
{
3842
if (EditorApplication.isPlayingOrWillChangePlaymode)

0 commit comments

Comments
 (0)