jacobdufault / fullinspector

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

Example for generic property editors doesn't compile #118

Closed krainert closed 9 years ago

krainert commented 9 years ago

The example on generic property editors doesn't compile for me; code:

using FullInspector;
using UnityEngine;

[CustomPropertyEditor(typeof(Ref<>))]
public class RefPropertyEditor<ComponentType> : PropertyEditor<Ref<ComponentType>>
    where ComponentType : Component {
    private IPropertyEditor _componentPropertyEditor = PropertyEditor.Get(typeof(ComponentType));
    public override Ref<ComponentType> Edit(Rect region, GUIContent label, Ref<ComponentType> element, fiGraphMetadata metadata) {
        ComponentType component = (ComponentType)_componentPropertyEditor.Edit(region, label, element.Value);
        return new Ref<ComponentType> {
            Value = component
        };
    }
    public override float GetElementHeight(GUIContent label, Ref<ComponentType> element, fiGraphMetadata metadata) {
        return _componentPropertyEditor.GetElementHeight(label, element.Value);
    }
}

Errors:

Error   1   No overload for method 'Get' takes 1 arguments  RefPropertyEditor.cs    7   56
Error   2   No overload for method 'Edit' takes 3 arguments RefPropertyEditor.cs    9   50
Error   3   No overload for method 'GetElementHeight' takes 2 arguments RefPropertyEditor.cs    15  16

Am I doing something wrong, or is the example obsolete?

jacobdufault commented 9 years ago

The example is likely out of date, I'll push an update soon and close the issue when I do.

krainert commented 9 years ago

Roger that. Thanks!

jacobdufault commented 9 years ago

Okay, I've pushed out new docs. They are available here. Note that I no longer update the old docs (it's a big pain) - when I migrate everything over to the new ones I'll take them down.

krainert commented 9 years ago

Beautiful, works like a charm! Thanks!