Welcome,
Guest
. Please
login
or
register
.
May 02, 2026, 06:10:44 PM
Home
Help
Search
Login
Register
Tasharen Entertainment Forum
»
Support
»
NGUI 3 Support
»
mySprite.sprite deprecated?
« previous
next »
Print
Pages: [
1
]
Author
Topic: mySprite.sprite deprecated? (Read 2810 times)
theprojectabot
Guest
mySprite.sprite deprecated?
«
on:
February 26, 2013, 04:39:59 PM »
Hi there, just updated to the new version of NGUI and now my wIcon.sprite = sT.sprite; is no longer working. I understand it is now protected with SetAtlasSprite. But for some reason my dumb brain isnt getting how to replicate the behavior I had before. Could you help me?
private
void
SwapTool
(
GameObject selectedTool
)
{
//Tool gets pressed, so the pickedObject.
Transform background
=
SearchHierarchyForTransform
(
selectedTool
.
transform
,
"Background"
)
;
UISlicedSprite sT
=
background
.
GetComponentInChildren
<
UISlicedSprite
>
(
)
;
if
(
sT
!=
null
)
{
//Swap out icon on active tool and close log bar.
// Need: reference to active tool icon.
if
(
WeaponIcon
!=
null
)
{
//Get component
UISprite wIcon
=
WeaponIcon
.
GetComponentInChildren
<
UISprite
>
(
)
;
if
(
wIcon
!=
null
)
{
wIcon
.
sprite
=
sT
.
sprite
;
//NOW wIcon.SetAtlasSprite(sT.GetAtlasSprite()); though this doesnt work...
}
}
}
// Close log bar
if
(
BottomControls
!=
null
)
{
NGUITools
.
SetActive
(
BottomControls,
false
)
;
}
// change power on BrontoController
}
#endregion
Logged
ArenMook
Administrator
Hero Member
Thank You
-Given: 337
-Receive: 1171
Posts: 22,128
Toronto, Canada
Re: mySprite.sprite deprecated?
«
Reply #1 on:
February 26, 2013, 07:42:43 PM »
I removed it precisely because people were using it.
Always set your sprite using UISprite.spriteName.
Logged
theprojectabot
Guest
Re: mySprite.sprite deprecated?
«
Reply #2 on:
February 26, 2013, 08:37:12 PM »
Ok ill go that route.
Logged
Print
Pages: [
1
]
« previous
next »
Tasharen Entertainment Forum
»
Support
»
NGUI 3 Support
»
mySprite.sprite deprecated?