I have a PlayerInput component (from the new input system package) and it defines a property ‘camera’. But it shadows the ‘camera’ property from ‘UnityEngine.Component’.
So when looking for available properties to set, the reflection code fails.
Here is a fix:
In EditorUtils.ContextMenu.cs, ‘static GenericMenu Internal_GetMethodSelectionMenu’
//get the actual property to check for ObsoleteAttribute
if ( method.Name.StartsWith(“get_”) || method.Name.StartsWith(“set_”) )
{
var name = method.Name.Replace(“get_”, “”).Replace(“set_”, “”);
var bindingFlags = BindingFlags.Instance | BindingFlags.Public;
try
{
member = method.DeclaringType.GetProperty(name, bindingFlags);
}
catch (AmbiguousMatchException) { bindingFlags |= BindingFlags.DeclaredOnly; }
member = member ?? method.DeclaringType.GetProperty(name, bindingFlags);
}
This code will try the previous search, but if an ambiguity occurs, it searches only for the provided type and not its ancestors.