Breaking change in HideIf attribute in 3.0

Issue #727 open
Eran Yaacobi created an issue

1. What happened?

The following code used to work in version 2.1.13:

[HideIf(nameof(IsPrefabOrPrefabStageRoot))]
public String InstanceId;

private Boolean IsPrefabOrPrefabStageRoot(){...}

private Boolean IsPrefabOrPrefabStageRoot(Boolean setNestedAsset){...}

The behaviour in version 2.1.13 was that the first method was selected in this case.

In 3.0.2, an error is shown instead (see picture below)

Given that the overload with the boolean parameter is not valid (throws an error if it’s the only one), I think it should ignore it, in which case there would be again just one method left (and thus no ambiguity).

2. How can we reproduce it?

Use above code.

3. If screenshots would help explain or demonstrate your issue, please include these.

4. What version of Unity are you using?

2020.1.0

5. What version of Odin are you using? (See "Tools > Odin Inspector > About")

3.0.2

6. Do you have Editor Only mode enabled?

Yes

7. What operating system are you on?

Windows 10

Comments (2)

  1. Tor Esa Vestergaard
    • changed status to open

    A fair point - .NET's reflection API made this a bit tedious to do without impacting performance, so we made the trade-off of having this potential breaking change. However, it is possible to catch the specific edge case and only then perform the more expensive and complicated lookups to find matching methods. I will make a note to add this in a future patch.

  2. Log in to comment