public override void OnInspectorGUI() { DrawDefaultInspector(); Themeable myScript = target as Themeable; if (GUILayout.Button("Update Resources")) { myScript.ReloadResources(); } }
public override void OnInspectorGUI() { DrawDefaultInspector(); Themeable myScript = target as Themeable; if (GUILayout.Button("Update Resources")) { Theme currentTheme = ThemeManager.Instance.GetCurrentTheme(); myScript.ReloadResources(currentTheme); } }
public override void OnInspectorGUI() { DrawDefaultInspector(); Themeable themeable = target as Themeable; if (GUILayout.Button("Update Resources")) { themeable.ReloadResources(ThemeManager.CurrentTheme); EditorUtility.SetDirty(themeable.gameObject); } }
private void RegisterUndo(Themeable themeable) { themeable.GetAffectedObjects().Where(it => it != null).ForEach(affectedObject => { Undo.RecordObject(affectedObject, $"Apply theme '{ThemeManager.CurrentTheme.Name}'"); // For some reason, Undo.RecordObject is not enough. Thus, also mark the affected object as dirty. EditorUtility.SetDirty(affectedObject); if (affectedObject is MonoBehaviour so) { EditorUtility.SetDirty(so.gameObject); } }); }