Welcome,
Guest
. Please
login
or
register
.
January 23, 2026, 10:37:21 PM
Home
Help
Search
Login
Register
Tasharen Entertainment Forum
»
Support
»
NGUI 3 Support
»
NGUI Sprire not visible in 3d when added by code
« previous
next »
Print
Pages: [
1
]
Author
Topic: NGUI Sprire not visible in 3d when added by code (Read 2450 times)
alexKhvorov
Guest
NGUI Sprire not visible in 3d when added by code
«
on:
September 25, 2013, 11:29:55 AM »
As above
When i add them by hand its nice two-sided GO with sprites, but when i do this by code
GameObject squadUnit
=
new
GameObject
(
"squadUnit"
+
i
)
;
UISprite uiSpr
=
squadUnit
.
AddComponent
<
UISprite
>
(
)
;
uiSpr
.
atlas
=
atlas
;
uiSpr
.
spriteName
=
"frame2"
;
uiSpr
.
panel
=
uiPanel
;
squadUnit
.
transform
.
parent
=
panel
.
transform
;
UISpriteAnimation uiSprAnim
=
squadUnit
.
AddComponent
<
UISpriteAnimation
>
(
)
;
uiSprAnim
.
framesPerSecond
=
8
;
uiSprAnim
.
namePrefix
=
"frame"
;
I see a rectangles but animation frames not visible
How to add them properly?
«
Last Edit: September 25, 2013, 11:38:09 AM by alexKhvorov
»
Logged
ArenMook
Administrator
Hero Member
Thank You
-Given: 337
-Receive: 1171
Posts: 22,128
Toronto, Canada
Re: NGUI Sprire not visible in 3d when added by code
«
Reply #1 on:
September 25, 2013, 07:26:04 PM »
You need to use NGUITools.AddChild<UISprite>(parent), not new GameObject/AddComponent. You never set the layer, which is your problem.
Logged
Print
Pages: [
1
]
« previous
next »
Tasharen Entertainment Forum
»
Support
»
NGUI 3 Support
»
NGUI Sprire not visible in 3d when added by code