com.soosvet_games.common_tools 1.1.4 → 1.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8,16 +8,35 @@ namespace SoosvetGames.CommonTools.Extensions.Editor
8
8
  {
9
9
  static HierarchyActivationTool()
10
10
  {
11
+ #if UNITY_6000_5_OR_NEWER
12
+ EditorApplication.hierarchyWindowItemByEntityIdOnGUI -= HierarchyWindowOnGui;
13
+ EditorApplication.hierarchyWindowItemByEntityIdOnGUI += HierarchyWindowOnGui;
14
+ #else
15
+ EditorApplication.hierarchyWindowItemOnGUI -= HierarchyWindowOnGui;
11
16
  EditorApplication.hierarchyWindowItemOnGUI += HierarchyWindowOnGui;
17
+ #endif
12
18
  }
13
19
 
20
+ #if UNITY_6000_5_OR_NEWER
21
+
22
+ private static void HierarchyWindowOnGui(EntityId entityId, Rect selectionRect)
23
+ {
24
+ var obj = EditorUtility.EntityIdToObject(entityId) as GameObject;
25
+
26
+ DrawToggle(obj, selectionRect);
27
+ }
28
+
29
+ #else
30
+
14
31
  private static void HierarchyWindowOnGui( int instanceId, Rect selectionRect )
15
32
  {
16
- var obj = EditorUtility.InstanceIDToObject( instanceId ) as GameObject;
33
+ var obj = Resources.InstanceIDToObject( instanceId ) as GameObject;
17
34
 
18
35
  DrawToggle( obj, selectionRect );
19
36
  }
20
37
 
38
+ #endif
39
+
21
40
  private static void DrawToggle( GameObject obj, Rect selectionRect )
22
41
  {
23
42
  if ( obj == null )
@@ -26,7 +45,8 @@ namespace SoosvetGames.CommonTools.Extensions.Editor
26
45
  var rect = new Rect( selectionRect ) { x = 35, width = 18 };
27
46
 
28
47
  bool previousValue = obj.activeSelf;
29
- bool newValue = GUI.Toggle( rect, previousValue, string.Empty );
48
+
49
+ bool newValue = GUI.Toggle( rect, previousValue, GUIContent.none );
30
50
 
31
51
  if ( newValue == previousValue )
32
52
  return;
@@ -36,6 +56,8 @@ namespace SoosvetGames.CommonTools.Extensions.Editor
36
56
  obj.SetActive( newValue );
37
57
 
38
58
  EditorUtility.SetDirty( obj );
59
+
60
+ EditorApplication.RepaintHierarchyWindow();
39
61
  }
40
62
  }
41
63
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name" : "com.soosvet_games.common_tools",
3
3
  "displayName" : "Soosvet Games Common Tools",
4
- "version" : "1.1.4",
4
+ "version" : "1.1.6",
5
5
  "author" : "Soosvet Games",
6
6
  "description" : "Common tools for Unity.",
7
7
  "repository": {