vexe / VFW

MIT License
491 stars 67 forks source link

Ambiguous Calls #111

Open Kromilan opened 5 years ago

Kromilan commented 5 years ago

First of all, thank you for the project. All I have seen about it looks really amazing. :) Unfortunately, I am apparently not experienced enought to get the plugin to work. I only use Unity as a hobby from time to time and didn't receive any propper teachings in C#, so I hope my problems are easy to solve :)


After importing the Plugin folder, there were basically two ambiguous call errors. In MethodeInfo.GetCustomAttribute, MemberInfo.GetCustomAttribute, MemberInfo.IsDefined, FiledInfo.IsDefined and PropertyInfo.IsDefined, there is ambiguity between System.Reflection.CustomAttributeExtensions.GetCustomAttribute and Vexe.Runtime.Extensions.MemberInfoExtensions.GetCustomAttribute and System.Reflection.CustomAttributeExtensions.IsDefined and Vexe.Runtime.Extensions.MemberInfoExtensions.IsDefined respectively.


The MethodeInfo.GetCustomAttribute error appeared in: Assets/Plugins/Editor/Vexe/Drawers/API/Core/MethodeDrawer.cs Line 54

The MemberInfo.GetCustomAttribute error appeared in Assets/Plugins/Editor/Vexe/Editors/Internal/...

The .IsDefined Errors appeard in Assets/Plugins/Editor/Vexe/Visibility/VisibiliyLogic.cs in the lines: 39, 63, 68, 71, 81 & 93


Unity Version 2019.2.3f1


As said, I don't really know that much about C#. So what would be the best Way to resolve these problems? I'm looking forward to any help :)

DoomT-AliW commented 5 years ago

Hi, I'm sorry you're going through these issues. I really need to make some time to update this plugin. It's really tough when you start to work full time.

At the time of writing there wasn't any IsDefined or GetCustomAttribute methods built in so I had to write them as extension methods.

For now, if you want to fix it yourself, you just have to rename the extension method I'm using, nowadays I usually go with the 'EX' postfix to denote that something is an extension method. So if you're using Visual Studio, (F12) on 'IsDefined' to go to its definition, and then (Ctrl+R, R) to enter rename mode, and just change it to IsDefinedEX, do the same for GetCustomAttribute. This will rename the method and all the caller sites referencing it.

Cheers

MaDDoXbr commented 4 years ago

While Vexe (Hi Vexe!) can't touch the project again, I'll recommend checking out NaughtyAttributes. It's free and spite of not supporting nesting (just yet, v2 is coming), it's very functional and relies purely on Unity native custom attributes. https://github.com/dbrizov/NaughtyAttributes