arimger / Unity-Editor-Toolbox

Tools, custom attributes, drawers, hierarchy overlay, and other extensions for the Unity Editor.
MIT License
1.73k stars 125 forks source link

Label By Child Attribute Conflicts with ReorderableList Attribute . #70

Closed Zenodeon closed 1 year ago

Zenodeon commented 1 year ago

Looking for Similar feature of Allow Nesting Attribute from Naughty Attributes, Which allows its attributes to work inside other Classes.

Zenodeon commented 1 year ago

For Eg.

[SerializeField] private List<RandomClass> roads = new List<RandomClass>();

public class RandomClass
{
    [ShowIf(...)] public float floatValue;
    [ShowIf(...)] public string stringValue;
    [ShowIf(...)] public int intValue;
}

ShowIf here does not work when these values are drawn in the inspector and will be shown even when it is false.

arimger commented 1 year ago

There is no need for such attribute like AllowNesting, this should work as expected by default. You can check the examples in the project for more details.

Let's try to fix it. Only the ShowIf and other conditional attributes are not working or attributes like InLineEditor too? Do you have issues only in lists or:

[SerializeField] 
private RandomClass randomClass;

works ok?

Do you use any additional Inspector-based plugins in the project? NaughtAttributes, Odin, etc.

Zenodeon commented 1 year ago

I will try your requests in a day or so with other attributes as well and let you know soon.

And i am using naughty attributes which is modified to use this plugins Toobox Editor.

Zenodeon commented 1 year ago

Found the issue, it's the [LabelByChild("variableName")] , using this on the list with [ReorderableList(ListStyle.Round, Foldable = true)] (not sure if ReorderableList is relevant here) it overrides all of the attributes of the class inside the list.

Zenodeon commented 1 year ago

I will do some testing with them and post an update soon.

While we are here, what's the equivalent Naughty Attributes Label in this plugin, the Label in this plugin is adding a header. I need an Attribute that changes the variable name in the inspector only.

arimger commented 1 year ago

As mentioned in the README.md, LabelByChildAttribute is unfortunately part of the old, non-Toolbox attributes so it overrides all Toolbox-only features.

While we are here, what's the equivalent Naughty Attributes Label in this plugin, the Label in this plugin is adding a header. I need an Attribute that changes the variable name in the inspector only.

NewLabelAttribute

Zenodeon commented 1 year ago

LabelByChildAttribute is unfortunately part of the old, non-Toolbox attributes so it overrides all Toolbox-only features.

any plans to fix this in the future?

Zenodeon commented 1 year ago

also I dont see it being mentioned anywhere near the LabelByChildAttribute part in the readme file.

arimger commented 1 year ago

Unfortunately, it was briefly mentioned only on the Wiki page. I will change it in the next update.

any plans to fix this in the future?

Yes, I plan to transfer all "regular" drawers into Toolbox drawers to support all features.

Zenodeon commented 1 year ago

I modified the ToolboxEditorList to support LabelByChild by a bool input and works good.

If i have some free time left, i will see if i can pr this feature in.

arimger commented 1 year ago

Sure, feel free, I'll try to move LabelByChild to the Toolbox drawers as soon as possible.

arimger commented 1 year ago

Hello, I added better support for the LabelByChildAttribute in https://github.com/arimger/Unity-Editor-Toolbox/pull/73. Your PR can probably be declined.