Author Topic: Check if a spritename exists in a UISprite  (Read 1868 times)

Tatanan

  • Jr. Member
  • **
  • Thank You
  • -Given: 11
  • -Receive: 0
  • Posts: 81
    • View Profile
    • Casual Arena
Check if a spritename exists in a UISprite
« on: May 04, 2015, 10:09:04 AM »
If I make
  1. uiSprite.spriteName = "xxx";
I'm changing the sprite of a UISprite object.
But, how could I know if "xxx" is indeed in the atlas, ie, if it exists?
Game developer on Casual Arena.

r.pedra

  • Full Member
  • ***
  • Thank You
  • -Given: 7
  • -Receive: 20
  • Posts: 131
    • View Profile
Re: Check if a spritename exists in a UISprite
« Reply #1 on: May 04, 2015, 10:15:43 AM »
  1. if (atlas.GetSprite ("spriteName") != null)
Where atlas is the atlas. If you have multiple atlas and need to find in which atlas it is, you have to do the test on each atlas