Welcome,
Guest
. Please
login
or
register
.
April 28, 2026, 09:30:17 PM
Home
Help
Search
Login
Register
Tasharen Entertainment Forum
»
Support
»
NGUI 3 Support
»
Programatically set NGUI events.
« previous
next »
Print
Pages: [
1
]
Author
Topic: Programatically set NGUI events. (Read 3155 times)
vidjogamer
Newbie
Thank You
-Given: 0
-Receive: 0
Posts: 48
Programatically set NGUI events.
«
on:
May 27, 2014, 04:45:48 PM »
Hello, I want to instantiate a some of your built in prefabs like the simple control button, then set its on click to a function of my choice. How does one do this via code?
Logged
Nicki
Global Moderator
Hero Member
Thank You
-Given: 33
-Receive: 141
Posts: 1,768
Re: Programatically set NGUI events.
«
Reply #1 on:
May 28, 2014, 04:04:04 AM »
UIButton has a public list of EventDelegates
public
List
<
EventDelegate
>
onClick
=
new
List
<
EventDelegate
>
(
)
;
that can hook up to.
UIButton myButton
;
void
Start
(
)
{
EventDelegate
.
Add
(
myButton
.
onClick
, MyMethod
)
;
}
void
MyMethod
(
)
{
Debug
.
Log
(
"My button was clicked!"
)
;
}
Logged
Print
Pages: [
1
]
« previous
next »
Tasharen Entertainment Forum
»
Support
»
NGUI 3 Support
»
Programatically set NGUI events.