dbrizov / NaughtyAttributes

Attribute Extensions for Unity
MIT License
4.58k stars 465 forks source link

[Issue] NaughtyAttributes breaks the custom editor of another library that doesn't use this one #249

Open JesseTG opened 3 years ago

JesseTG commented 3 years ago

When NaughtyAttributes and Random-Generators are both installed in a project, the custom editor for a certain type within Random-Generators breaks. More details are available in this bug I just filed within Random-Generators.

I don't know which library is responsible for the bug, so I'm reporting it in both.

Note that Random-Generators does not use NaughtyAttributes. I don't directly use it either, but a dependency within my project does.

IF-ACT commented 3 years ago

It happens because NaughtyAttributes rely on the attribute [CustomEditer(Object, true)] for its main editor, and may break other custom editors.

It's not easy to fix. But if any one who is interested with this issue, can look into here in Unity's source code. Unity uses GetTypesWithAttribute<CustomEditor>() to get custom attributes and then save them into two dictionaries, so there might be a way to register custom editors into these dictionaries without using CustomEditor attribute.