Welcome,
Guest
. Please
login
or
register
.
December 07, 2024, 06:45:30 AM
Home
Help
Search
Login
Register
Tasharen Entertainment Forum
»
Support
»
NGUI 3 Support
»
Event listener not doing anything...
« previous
next »
Print
Pages: [
1
]
Author
Topic: Event listener not doing anything... (Read 1994 times)
Rafe
Jr. Member
Thank You
-Given: 0
-Receive: 0
Posts: 78
Event listener not doing anything...
«
on:
July 22, 2012, 04:23:21 AM »
Hi,
I think I am setting this up correctly:
// In the class
public
UIImageButton playButton
;
// in Start()
UIEventListener
.
Get
(
this
.
playButton
.
gameObject
)
.
onClick
+=
this
.
OnPlay
;
// My func definition
public
void
OnPlay
(
GameObject obj
)
{
Debug
.
Log
(
"OnPlay"
)
;
}
The log message never plays and there are no error messages.
I attached a test script and the button IS getting an OnClick event
When I play the game no UIEventListener component is added to the gameObject. I tried adding one manually and it didn't have any effect.
Any thoughts?
Logged
Rafe
Jr. Member
Thank You
-Given: 0
-Receive: 0
Posts: 78
Re: Event listener not doing anything...
«
Reply #1 on:
July 22, 2012, 06:01:37 AM »
Well it works. There was null reference exception (needed to drag&drop an unrelated reference used in the same script) that was quietly breaking this. Once I fixed it the tap started flowing again!
Logged
Print
Pages: [
1
]
« previous
next »
Tasharen Entertainment Forum
»
Support
»
NGUI 3 Support
»
Event listener not doing anything...