com.wallstop-studios.unity-helpers 2.0.0-rc73.15 → 2.0.0-rc73.17

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.
@@ -13,7 +13,9 @@
13
13
  [CustomPropertyDrawer(typeof(SourceFolderEntry))]
14
14
  public sealed class SourceFolderEntryDrawer : PropertyDrawer
15
15
  {
16
- private static readonly Dictionary<string, bool> RegexesFoldoutState = new();
16
+ private static readonly Dictionary<string, bool> RegexesFoldoutState = new(
17
+ StringComparer.Ordinal
18
+ );
17
19
 
18
20
  public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
19
21
  {
@@ -179,7 +181,10 @@
179
181
  availableWidth,
180
182
  EditorGUIUtility.singleLineHeight
181
183
  );
182
- string regexesFoldoutKey = property.propertyPath + ".regexesList";
184
+ string regexesFoldoutKey =
185
+ property.serializedObject.targetObject.name
186
+ + property.propertyPath
187
+ + ".regexesList";
183
188
  RegexesFoldoutState.TryAdd(regexesFoldoutKey, true);
184
189
  RegexesFoldoutState[regexesFoldoutKey] = EditorGUI.Foldout(
185
190
  regexFoldoutLabelRect,
@@ -178,6 +178,37 @@
178
178
  SerializedObject serializedConfig = new(config);
179
179
  serializedConfig.Update();
180
180
  EditorGUI.BeginChangeCheck();
181
+
182
+ string currentAssetName = config.name;
183
+ Rect nameRect = EditorGUILayout.GetControlRect();
184
+ EditorGUI.BeginChangeCheck();
185
+ string newAssetName = EditorGUI.TextField(
186
+ new Rect(nameRect.x, nameRect.y, nameRect.width - 60, nameRect.height),
187
+ "Asset Name",
188
+ currentAssetName
189
+ );
190
+ if (EditorGUI.EndChangeCheck())
191
+ {
192
+ if (
193
+ !string.IsNullOrWhiteSpace(newAssetName)
194
+ && newAssetName != currentAssetName
195
+ && AssetDatabase.Contains(config)
196
+ )
197
+ {
198
+ string assetPath = AssetDatabase.GetAssetPath(config);
199
+ string error = AssetDatabase.RenameAsset(assetPath, newAssetName);
200
+ if (string.IsNullOrWhiteSpace(error))
201
+ {
202
+ LoadAtlasConfigs();
203
+ GUIUtility.ExitGUI();
204
+ }
205
+ else
206
+ {
207
+ this.LogError($"Failed to rename asset: {error}");
208
+ }
209
+ }
210
+ }
211
+
181
212
  SerializedProperty scriptProperty = serializedConfig.FindProperty("m_Script");
182
213
  if (scriptProperty != null)
183
214
  {
@@ -191,7 +222,7 @@
191
222
  while (property.NextVisible(enterChildren))
192
223
  {
193
224
  enterChildren = false;
194
- if (property.name == "m_Script")
225
+ if (string.Equals(property.name, "m_Script", StringComparison.Ordinal))
195
226
  {
196
227
  continue;
197
228
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "com.wallstop-studios.unity-helpers",
3
- "version": "2.0.0-rc73.15",
3
+ "version": "2.0.0-rc73.17",
4
4
  "displayName": "Unity Helpers",
5
5
  "description": "Various Unity Helper Library",
6
6
  "dependencies": {},
@@ -51,3 +51,5 @@
51
51
 
52
52
 
53
53
 
54
+
55
+