Exemplo n.º 1
0
    public override void OnInspectorGUI()
    {
        DrawDefaultInspector();

        Themeable myScript = target as Themeable;

        if (GUILayout.Button("Update Resources"))
        {
            myScript.ReloadResources();
        }
    }
Exemplo n.º 2
0
    public override void OnInspectorGUI()
    {
        DrawDefaultInspector();

        Themeable myScript = target as Themeable;

        if (GUILayout.Button("Update Resources"))
        {
            Theme currentTheme = ThemeManager.Instance.GetCurrentTheme();
            myScript.ReloadResources(currentTheme);
        }
    }
Exemplo n.º 3
0
    public override void OnInspectorGUI()
    {
        DrawDefaultInspector();

        Themeable themeable = target as Themeable;

        if (GUILayout.Button("Update Resources"))
        {
            themeable.ReloadResources(ThemeManager.CurrentTheme);
            EditorUtility.SetDirty(themeable.gameObject);
        }
    }
Exemplo n.º 4
0
 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);
         }
     });
 }