Welcome,
Guest
. Please
login
or
register
.
October 06, 2024, 05:35:00 AM
Home
Help
Search
Login
Register
Tasharen Entertainment Forum
»
Support
»
NGUI 3 Support
»
[Solved]Alpha 0 on gameobject's children: not working?
« previous
next »
Print
Pages: [
1
]
Author
Topic: [Solved]Alpha 0 on gameobject's children: not working? (Read 2524 times)
Somoraze
Guest
[Solved]Alpha 0 on gameobject's children: not working?
«
on:
March 25, 2013, 05:03:08 AM »
Hi,
I found this thread (
http://www.tasharen.com/forum/index.php?topic=311.0
) to add an alpha value to a gameObject: I would like to hide a Panel with all its children (2 labels, and 1 sprite), but its children are not recognized by NGUI, would you know why? (GameObject.name works well though) :
private
static
void
SetNguiVisible
(
GameObject gameObject,
bool
visible
)
{
//Debug.Log("setNgui");//works fine
Debug
.
Log
(
"gameObject.GetComponents<UIWidget>() : "
+
gameObject
.
GetComponents
<
UIWidget
>
(
)
.
Length
)
;
//output 0
foreach
(
UIWidget widget
in
gameObject
.
GetComponents
<
UIWidget
>
(
)
)
//same with var widget
{
Debug
.
Log
(
"A"
)
;
//does not show up
widget
.
enabled
=
visible
;
}
}
I call it like this :
//in the child script
void
OnClick
(
)
{
startTween
(
0
)
;
}
//in the parent script
protected
string
changeIndex
(
int
indexp
)
{
switch
(
indexp
)
{
case
0
:
return
"PanelLevel"
;
//...
protected
void
startTween
(
int
indexp
)
{
string
newPanel
=
changeIndex
(
indexp
)
;
string
oldPanel
=
changeIndex
(
currentIndex
)
;
if
(
currentIndex
!=
indexp
)
{
SetNguiVisible
(
GameObject
.
Find
(
oldPanel
)
,
false
)
;
//...
Would you have any idea?
Thanks
«
Last Edit: March 25, 2013, 07:47:17 AM by Somoraze
»
Logged
broken
Full Member
Thank You
-Given: 1
-Receive: 4
Posts: 140
Re: Alpha 0 on gameobject's children: not working?
«
Reply #1 on:
March 25, 2013, 05:23:38 AM »
Hi!
Why not just use:
TweenAlpha
.
Begin
(
gameObject, duration, alpha
)
for change alpha?
Logged
Somoraze
Guest
Re: Alpha 0 on gameobject's children: not working?
«
Reply #2 on:
March 25, 2013, 07:46:57 AM »
argh, it works better, thanks!
Logged
Print
Pages: [
1
]
« previous
next »
Tasharen Entertainment Forum
»
Support
»
NGUI 3 Support
»
[Solved]Alpha 0 on gameobject's children: not working?