Author Topic: Event Receiver Weirdness  (Read 1607 times)

Yukichu

  • Full Member
  • ***
  • Thank You
  • -Given: 3
  • -Receive: 8
  • Posts: 101
    • View Profile
Event Receiver Weirdness
« on: September 12, 2013, 03:16:55 PM »
Just some inconsistencies in pre-3.0 nonprofessional version...

Create a checkbox (I know it's going away, but still) and the EventReceiver is empty.
Create a new script object for the checkbox, add OnActivate (default function name) and it works.  It's receiving the event by default.

Create a UIInput (more relevant) and the EventReceiver is empty at default as well.
Create a new script object for the UIInput, add OnSubmit (default function name) and it works.  It's receiving the event by default.

Create a UISlider, and EventReceiver once again is empty by default.
Create a new script object for the UISlider, add OnSliderChange(float val) (default function name) and it does not work.  After looking at the UISlider code, I saw it was looking for an EventReceiver object and would not work otherwise.  Once I added the gameobject of itself to the EventReceiver, it then started working.

I believe I read the 3.0 version of NGUI was changing the Event system in some manner, and it this doesn't really matter in the future that's cool.  It was just very frustrating when other NGUI objects behaved in one way, so I didn't think the UISlider would behave any differently. 

Thanks

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Event Receiver Weirdness
« Reply #1 on: September 13, 2013, 09:32:32 AM »
Yup, this was changed completely in 3.0, and they are all consistent now.