Tasharen Entertainment Forum
Support => NGUI 3 Support => Topic started by: brian661 on April 02, 2014, 08:46:44 AM
Title:
Change the texture of UItexture
Post by:
brian661
on
April 02, 2014, 08:46:44 AM
I would like to change the texture dynamically by using something like
GameObject loadedPrefab
=
Resources
.
Load
(
"item"
)
as
GameObject
;
loadedPrefab
.
transform
.
GetComponent
<
UITexture
>
(
)
.
mainTexture
=
""
;
where item is a Texture widget prefab,
My image have been add to the atlas, or inside the Asset/Resources/image folder,
how can i set it to the mainTexture?
Title:
Re: Change the texture of UItexture
Post by:
brian661
on
April 02, 2014, 08:57:26 AM
I find the ans
loadedPrefab
.
transform
.
GetComponent
<
UITexture
>
(
)
.
mainTexture
=
Resources
.
Load
(
"your texture location"
)
as
Texture
;