Welcome,
Guest
. Please
login
or
register
.
April 22, 2026, 06:35:58 AM
Home
Help
Search
Login
Register
Tasharen Entertainment Forum
»
Support
»
NGUI 3 Support
»
The variable tweenTarget of buttonClick has not been assigned.
« previous
next »
Print
Pages: [
1
]
Author
Topic: The variable tweenTarget of buttonClick has not been assigned. (Read 3981 times)
fghjru
Newbie
Thank You
-Given: 0
-Receive: 0
Posts: 8
The variable tweenTarget of buttonClick has not been assigned.
«
on:
April 01, 2014, 09:57:45 AM »
SetState(State.Disabled, false); cause an error: "The variable tweenTarget of buttonClick has not been assigned". What am I doing wrong?
using
UnityEngine
;
using
System.Collections
;
public
class
buttonClick
:
UIButton
{
protected
override
void
OnClick
(
)
{
Debug
.
Log
(
"Super Effect!"
)
;
}
protected
override
void
OnEnable
(
)
{
StartCoroutine
(
wait
(
0
)
)
;
Debug
.
Log
(
"OnEnable()"
)
;
}
public
void
Init
(
Vector3 indent,
System
.
Action
action, EventDelegate
.
Callback
callback
)
{
this
.
indent
=
indent
;
this
.
Clicked
=
action
;
this
.
callback
=
callback
;
UIEventTrigger trigger
=
GetComponent
<
UIEventTrigger
>
(
)
;
EventDelegate
.
Add
(
trigger
.
onHoverOut
, callback
)
;
}
IEnumerator wait
(
float
waitTime
)
{
yield
return
new
WaitForSeconds
(
waitTime
)
;
transform
.
localPosition
+=
this
.
indent
;
SetState
(
State
.
Disabled
,
false
)
;
// Error
}
}
Logged
fghjru
Newbie
Thank You
-Given: 0
-Receive: 0
Posts: 8
Re: The variable tweenTarget of buttonClick has not been assigned.
«
Reply #1 on:
April 01, 2014, 10:03:49 AM »
And I made a class derived from UIButton, and methods OnEnable(), OnClick() are overrided now. I don't understand how does void OnClick() work, when class inherited not from UIButton, but from MonoBehaviour?
Logged
ArenMook
Administrator
Hero Member
Thank You
-Given: 337
-Receive: 1171
Posts: 22,128
Toronto, Canada
Re: The variable tweenTarget of buttonClick has not been assigned.
«
Reply #2 on:
April 01, 2014, 10:45:41 AM »
OnClick is a regular NGUI event sent by the UICamera. Check the documentation for the UICamera for a full list. All colliders are able to receive NGUI events -- it's a generic event system that's not limited to the UI.
There is no need to derive anything from UIButton. Why are you doing that? UIButton is a stand-alone component providing specific functionality.
Logged
fghjru
Newbie
Thank You
-Given: 0
-Receive: 0
Posts: 8
Re: The variable tweenTarget of buttonClick has not been assigned.
«
Reply #3 on:
April 01, 2014, 11:18:35 AM »
Understood, thank you
Logged
Print
Pages: [
1
]
« previous
next »
Tasharen Entertainment Forum
»
Support
»
NGUI 3 Support
»
The variable tweenTarget of buttonClick has not been assigned.