Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: Biggix on May 15, 2016, 11:37:28 AM

Title: UIButton EventDelegate list is empty
Post by: Biggix on May 15, 2016, 11:37:28 AM
When I save a working UIButton into a prefab and then instantiate it during runtime in my game, the EventDelegate list (onClick) it was carrying goes empty and thus button doesn't do any actions.

Can you please share a bit of code for the recreation of the EventDelegate list with code after I instantiate it? For example, I need to execute SomeFunction() with SomeParameter that belongs to SomeScript on SomeGameObject.

Or maybe there is some other way to tackle this issue. Thank you!
Title: Re: UIButton EventDelegate list is empty
Post by: ArenMook on May 18, 2016, 04:48:30 AM
I'm guessing your event list is referencing an object outside of the button prefab.

This is simply not possible with the way Unity works. It's a limitation of the prefab system and makes perfect sense if you think about it. How can a prefab reference something that exists outside of it?