Skip to content

Commit 51dc1c2

Browse files
committed
Fix asset not being marked dirty when changed
1 parent e361431 commit 51dc1c2

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

org.mixedrealitytoolkit.uxcore/Editor/Inspectors/FontIconSet/FontIconSetInspector.cs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public class FontIconSetInspector : UnityEditor.Editor
3434
private const string TextMeshProMenuItem = "Window/TextMeshPro/Font Asset Creator";
3535

3636
private SerializedProperty iconFontAssetProp = null;
37-
private SerializedProperty fontIconSetDefinition = null;
37+
private SerializedProperty fontIconSetDefinitionProp = null;
3838

3939
private class IconEntry
4040
{
@@ -57,7 +57,7 @@ private void OnEnable()
5757
{
5858
FontIconSet fontIconSet = (FontIconSet)target;
5959
iconFontAssetProp = serializedObject.FindProperty("iconFontAsset");
60-
fontIconSetDefinition = serializedObject.FindProperty("fontIconSetDefinition");
60+
fontIconSetDefinitionProp = serializedObject.FindProperty("fontIconSetDefinition");
6161

6262
// Make a list out of dictionary to avoid changing order while editing names
6363
foreach (KeyValuePair<string, uint> kv in fontIconSet.GlyphIconsByName)
@@ -81,7 +81,7 @@ public override void OnInspectorGUI()
8181
if (showGlyphIconFoldout)
8282
{
8383
EditorGUILayout.PropertyField(iconFontAssetProp);
84-
EditorGUILayout.PropertyField(fontIconSetDefinition);
84+
EditorGUILayout.PropertyField(fontIconSetDefinitionProp);
8585

8686
if (iconFontAssetProp.objectReferenceValue == null)
8787
{
@@ -133,7 +133,7 @@ public override void OnInspectorGUI()
133133
{
134134
EditorGUILayout.HelpBox("These icons will appear in the button config helper inspector. Click an icon to remove it from this list.", MessageType.Info);
135135

136-
if (fontIconSetDefinition.objectReferenceValue == null)
136+
if (fontIconSetDefinitionProp.objectReferenceValue == null)
137137
{
138138
EditorGUILayout.HelpBox("It's recommended to use a Font Icon Set Definition to ensure consistent icon names across icon sets.", MessageType.Warning);
139139
}
@@ -252,6 +252,7 @@ private bool AddIcon(FontIconSet fontIconSet, uint unicodeValue)
252252
if (fontIconSet.AddIcon(name, unicodeValue))
253253
{
254254
iconEntries.Add(new IconEntry(name, unicodeValue));
255+
EditorUtility.SetDirty(fontIconSet);
255256
}
256257
return true;
257258
}
@@ -262,6 +263,7 @@ private bool RemoveIcon(FontIconSet fontIconSet, string iconName)
262263
if (removed && FindIconIndexByName(iconName, out int index))
263264
{
264265
iconEntries.RemoveAt(index);
266+
EditorUtility.SetDirty(fontIconSet);
265267
}
266268
return removed;
267269
}
@@ -284,6 +286,7 @@ private void UpdateIconName(FontIconSet fontIconSet, string oldName, string newN
284286
if (fontIconSet.UpdateIconName(oldName, newName) && FindIconIndexByName(oldName, out int index))
285287
{
286288
iconEntries[index].Name = newName;
289+
EditorUtility.SetDirty(fontIconSet);
287290
}
288291
}
289292

0 commit comments

Comments
 (0)