Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: chukaishing on October 16, 2016, 04:02:47 PM

Title: UIButton event do not support polymorphism method
Post by: chukaishing on October 16, 2016, 04:02:47 PM
I has two method like that
public void Foo () {
}
public void Foo (string str) {
}

I try to add Foo () to UIButton on click event, and I get this error:
"Could not find method 'Foo' on FooScript"

NGUI version is 3.10.2

This is a bug? and that will fix in future?
Title: Re: UIButton event do not support polymorphism method
Post by: ArenMook on October 17, 2016, 10:21:22 PM
You should have them uniquely named. The script that finds the delegate by name is pretty rudimentary. I was only learning reflection back when I wrote it. Just keep them named differently.
Title: Re: UIButton event do not support polymorphism method
Post by: chukaishing on October 18, 2016, 07:08:53 AM
You should have them uniquely named. The script that finds the delegate by name is pretty rudimentary. I was only learning reflection back when I wrote it. Just keep them named differently.

Tanks for your reply.
In my case, Foo() and Foo(string) must be exist.
I just add a method like that to fix now:
void FooForNGUI () { Foo(); }

I want to know, the reflection problem will fix in future?
If yes, I will still to waiting the update.