Author Topic: Upgrade 3.0.8f7 to 3.11.4 - SetSprite  (Read 307 times)

fdfragoso

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 1
    • View Profile
Upgrade 3.0.8f7 to 3.11.4 - SetSprite
« on: August 30, 2017, 02:58:40 AM »
Hi!

I'm working upgrading an old project to Unity 2017 and was made with Unity 4.6, this project uses NGUI the version 3.0.8f7 and I upgraded for the newest 3.11.4, but I'm getting a problem with the following code

  1. atlas = AtlasManager.GetAtlasBySprite(ref spriteName, spriteType);
  2.                 if(atlas != null) {
  3.                         UISpriteData spriteData = atlas.GetSprite(spriteName);
  4.                         if(spriteData != null)
  5.                         {
  6.                                 sprite.atlas = atlas;
  7.                                 sprite.SetSprite(spriteData);
  8.  
  9.                                 return true;
  10.                         }
  11.                 }
  12.  

What I saw the solution should be replacing the line
  1. sprite.SetSprite(spriteData) with sprite.spriteName = spriteName

I tried to find the old documentation or anything else in the forum and the documentation, but I couldn't.
Thanks

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,151
  • Toronto, Canada
    • View Profile
Re: Upgrade 3.0.8f7 to 3.11.4 - SetSprite
« Reply #1 on: August 30, 2017, 04:56:53 PM »
What is your code supposed to do? What's AtlasManager, and why does it have sprite data? Why do you assign it to sprites manually, and what's "sprite" anyway?