Author Topic: Get Sprite Atlas Index Number  (Read 2262 times)

coxy17

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 23
    • View Profile
Get Sprite Atlas Index Number
« on: March 24, 2017, 10:28:35 AM »
Hi

I heard a while ago that NGUI supported sprite animation, dont know if its still the case but i wanted to ask if its possible to target a specific sprite image inside an atlas? so i can generate one random image from a sprite sheet.

Nick

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Get Sprite Atlas Index Number
« Reply #1 on: March 26, 2017, 07:48:59 AM »
Well, NGUI supports drawing of sprites, and you can change what sprite is drawn at any time via sprite.spriteName = "abc" -- so yes, you can target a specific sprite easily.

UISpriteAnimation script is an example of basic sprite animation that cycles frames with the specified speed.

I'm not entirely sure what you meant by using an index.

coxy17

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 23
    • View Profile
Re: Get Sprite Atlas Index Number
« Reply #2 on: March 26, 2017, 11:52:33 AM »
Hi

Ok what i mean by index is when you create a atlas, i want to choose one of the items inside this by referencing a number value? e.g. 1=image 1..... 2= image 2
So if you are saying i can use the name sprite.spriteName = "abc" then i can just use numbers as the name then. Thanks.

Thanks and ill take a look at UISpriteAnimation.

Nick