Author Topic: Refreshing the Sprite of the UISprite  (Read 2928 times)

aikitect

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 27
    • View Profile
Refreshing the Sprite of the UISprite
« on: August 30, 2013, 10:19:14 PM »
Hello, I am creating an UIAtlas at runtime using an image from TexturePacker.  I am also using the NData package for NGUI and using that to set the sprite name.  This means that for every UISprite, there is initially a sprite name but no atlas (because I create it at runtime).  Therefore, after I generate the atlas I assign it to each UISprite in separate code.

This works fine in the Unity Editor.  It doesn't work as well on iPhone, where it will show up 50% of the time.  Therefore, I was wondering if there was a way to refresh the sprite so that NGUI would re-render it after I assigned the atlas.  Thanks!

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Refreshing the Sprite of the UISprite
« Reply #1 on: August 31, 2013, 01:10:57 PM »
I don't know how NData works, but setting the atlas keeps the sprite, and will automatically choose it from the atlas. You can force a refresh by calling the widget's MarkAsChanged function.