jacobdufault / fullinspector

Full Inspector supercharges Unity's inspector
MIT License
111 stars 27 forks source link

Toolkit's DefaultInspector not working inside groups #182

Open SugoiDev opened 7 years ago

SugoiDev commented 7 years ago

I'm trying to add a single button on top of the default inspector for my BaseScriptableObject derived objects and got this issue.

Is there a way to make this work with the toolkit?


Example code to add a single button above the default inspector for SomeScriptableObject I'm on Unity 5.4.2p2 and latest FullInspector from github. This issue is possibly related to ae168b134ce73085fcecb7dac5c858ec657899bc

using FullInspector;
using tk = FullInspector.tk<GlobalSettings>;

public class GlobalSettings: BaseScriptableObject, tkCustomEditor
{
    public tkControlEditor GetEditor() {
        var group = new tk.VerticalGroup {
            new tk.Button("Save", (o, context) => o.Save()),
            new tk.DefaultInspector()
        };

        return new tkControlEditor(group);
    }

    private void Save() {
        UnityEditor.EditorUtility.SetDirty(this);
        UnityEditor.EditorApplication.SaveAssets();
    }
}

How this is rendered screenshot 2016 11 02-19 11 22

Just by adding the DefaultInspector in a group we already have that

public tkControlEditor GetEditor() {
    var group = new tk.VerticalGroup {
        new tk.DefaultInspector()
    };

    return new tkControlEditor(group);
}

screenshot 2016 11 02-19 11 22 2