-
Notifications
You must be signed in to change notification settings - Fork 135
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Invoke() symbol resolution should check base class #138
Comments
Can the invoked function be a private method in the base class? Or does it have to be public/protected? |
Assuming the most misbehaved I don't have access to a compiler right now, so some of these may just not be legal code. In any case, in all but the
I don't think there could be a difference between Unity's docs specifically say they don't do overload resolution for arguments, so that doesn't need to be tested (though it could be checked (if it isn't already)). And let me just say again. Please don't do this. Especially when using |
@citizenmatt Running the following test it seems public, protected and private are supported.
However as pointed out by @CAD97 There's a few things to keep in mind if users try to invoke functions that share names in the base and the derived type. I just ran the following tests. Virtual
Non-Virtual
In both cases Unity (5.6.0f3) seemed to consistently invoke the derived class function. I still think that resolving symbols that are Unique to the base class should be supported (which was my original use case) :) |
Fantastic, thanks both! I've reworked this feature, and it will now include base class methods, including private methods on base classes. It automatically warns if a method name is ambiguous, because I'm not replicating Unity's logic to pick the most derived instance. I could add that, but I agree that I think it's useful to get the warning. We can revisit if anyone ever complains about it 😄 The other thing I've done is that now it can include base class methods, I filter out any methods that are defined in a base class that lives in the |
That sounds great, thanks! |
At the moment using the Invoke function with a method from a base class will "Fail to resolve symbol"
The text was updated successfully, but these errors were encountered: