Skip to content

Commit e6cf5d9

Browse files
committed
Merge remote-tracking branch 'arimger/develop' into develop
# Conflicts: # Assets/Editor Toolbox/Editor/ToolboxEditorSceneView.cs
2 parents 04dde25 + c54c2d3 commit e6cf5d9

26 files changed

+549
-150
lines changed

.github/workflows/upm-dev.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Update UPM branch (develop)
2+
on:
3+
push:
4+
branches:
5+
- develop
6+
jobs:
7+
split-upm:
8+
name: split upm branch
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v2
12+
with:
13+
fetch-depth: 0
14+
- name: split upm branch
15+
run: |
16+
git subtree split -P "$PKG_ROOT" -b upm-dev
17+
git push -u origin upm-dev
18+
env:
19+
PKG_ROOT: 'Assets/Editor Toolbox'

Assets/Editor Toolbox/CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
## 0.12.3 [17.06.2023]
2+
3+
### Changed:
4+
- Fix updating SerializedScene index after deleting Scene
5+
- Fix SerializedScene index calculation
6+
- Fix NRE when deleted Scene was still included in Build Settings
7+
- Fix compilation errors in Unity 2018.x
8+
9+
### Added:
10+
- SceneView extension: better way to select raycasted objects in the Scene view
11+
- LabelWidthAttribute
12+
113
## 0.12.1 [12.04.2023]
214

315
### Changed:
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
using UnityEditor;
2+
using UnityEngine;
3+
4+
namespace Toolbox.Editor.Drawers
5+
{
6+
[CustomPropertyDrawer(typeof(LabelWidthAttribute))]
7+
public class LabelWidthAttributeDrawer : PropertyDrawerBase
8+
{
9+
protected override void OnGUISafe(Rect position, SerializedProperty property, GUIContent label)
10+
{
11+
var previousWidth = EditorGUIUtility.labelWidth;
12+
EditorGUIUtility.labelWidth = Attribute.Width;
13+
EditorGUI.PropertyField(position, property, label, property.isExpanded);
14+
EditorGUIUtility.labelWidth = previousWidth;
15+
}
16+
17+
private LabelWidthAttribute Attribute => attribute as LabelWidthAttribute;
18+
}
19+
}

Assets/Editor Toolbox/Editor/Drawers/Regular/LabelWidthAttributeDrawer.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/Editor Toolbox/Editor/Drawers/Regular/SerializedSceneDrawer.cs

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ protected override void OnGUISafe(Rect position, SerializedProperty property, GU
5151
return;
5252
}
5353

54-
var sceneData = SceneData.GetSceneData(sceneProperty);
54+
var sceneData = SceneData.GetSceneDataFromIndex(property);
5555
var spacing = EditorGUIUtility.standardVerticalSpacing;
5656
position.y += EditorGUIUtility.singleLineHeight + spacing;
5757
if (sceneData.inBuild)
@@ -82,10 +82,21 @@ private struct SceneData
8282
{
8383
public int index;
8484
public bool enabled;
85-
public GUID guid;
8685
public bool inBuild;
8786

88-
public static SceneData GetSceneData(SerializedProperty property)
87+
public static SceneData GetSceneDataFromIndex(SerializedProperty property)
88+
{
89+
var indexProperty = property.FindPropertyRelative("buildIndex");
90+
var index = indexProperty.intValue;
91+
return new SceneData()
92+
{
93+
index = index,
94+
enabled = index != -1,
95+
inBuild = index != -1
96+
};
97+
}
98+
99+
public static SceneData GetSceneDataFromScene(SerializedProperty property)
89100
{
90101
var sceneData = new SceneData()
91102
{
@@ -101,7 +112,7 @@ public static SceneData GetSceneData(SerializedProperty property)
101112
for (var i = 0; i < EditorBuildSettings.scenes.Length; i++)
102113
{
103114
var sceneSettings = EditorBuildSettings.scenes[i];
104-
var isEnabled = sceneSettings.enabled;
115+
var isEnabled = sceneSettings.enabled && !string.IsNullOrEmpty(sceneSettings.path);
105116
if (isEnabled)
106117
{
107118
sceneIndex++;
@@ -112,7 +123,6 @@ public static SceneData GetSceneData(SerializedProperty property)
112123
{
113124
sceneData.index = isEnabled ? sceneIndex : -1;
114125
sceneData.enabled = isEnabled;
115-
sceneData.guid = guid;
116126
sceneData.inBuild = true;
117127
break;
118128
}

Assets/Editor Toolbox/Editor/Editors/ToolboxScriptedImporterEditor.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
using UnityEditor;
2+
#if UNITY_2020_2_OR_NEWER
23
using UnityEditor.AssetImporters;
4+
#else
5+
using UnityEditor.Experimental.AssetImporters;
6+
#endif
37

48
namespace Toolbox.Editor.Editors
59
{
@@ -15,11 +19,12 @@ public sealed override void OnInspectorGUI()
1519
public virtual void DrawCustomInspector()
1620
{
1721
Drawer.DrawEditor(serializedObject);
22+
#if UNITY_2020_2_OR_NEWER
1823
if (extraDataType != null)
1924
{
2025
Drawer.DrawEditor(extraDataSerializedObject);
2126
}
22-
27+
#endif
2328
ApplyRevertGUI();
2429
}
2530

0 commit comments

Comments
 (0)