Tasharen Entertainment Forum
Support => NGUI 3 Support => Topic started by: Sermolux on May 17, 2016, 12:36:23 AM
-
Hi,
I'm having an issue using UICamera.onClick as a catch all. When I first start the app it behaves as expected, but when I load a new scene I get a MissingReferenceException. I believe that the onClick event is still looking for the object in the previous scene. This happens for all events through UICamera. I find that if I set UICamera.onClick to null just before I load a scene everything works. Am I using this incorrectly?
-
You need to register it in the script's OnEnable, and unregister in OnDisable. I'm guessing you don't do the unregistration part, so yes of course you get an exception.