Author Topic: Atlas prefabs store source names instead of GUIDs  (Read 2140 times)

OnlineCop

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 51
    • View Profile
Atlas prefabs store source names instead of GUIDs
« on: September 09, 2013, 01:19:40 PM »
We created an atlas with images that have the naming convention Item_WIDTHxHEIGHT:
  1. Btn_Close_48x48
  2. Btn_Goals_48x48
  3. Btn_Options_48x48
  4. Btn_Pause_48x48
  5. Btn_Play_48x48
  6.  

The artists then decided that the images should be larger, so scaled up the images. We renamed the files to match their new dimensions:
  1. Btn_Close_64x64
  2. Btn_Goals_64x64
  3. Btn_Options_64x64
  4. Btn_Pause_64x64
  5. Btn_Play_64x64
  6.  

Unfortunately, the NGUI atlas stores the source image names in the atlas' prefab, instead of the source image GUIDs which means that all of our UIImageButtons and UISprites broke.

Is there a way that the GUIDs of the images could be stored in the atlas prefabs instead of the image names? Then if we rename the source image names, the atlas would still point to the correct images.

sisso

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 46
    • View Profile
Re: Atlas prefabs store source names instead of GUIDs
« Reply #1 on: September 09, 2013, 02:49:51 PM »
Think that the image name is sprite identifier, so don't use too specific stuff in filename, like color or size. So you can change without lose meaning.

Remember that sprites stay in the atlas with a name. After you import in atlas you can even delete them. There is no real relation between files and sprites. The NGUI uses the image name as sprite identifier, but I think that you can use whatever you want with some code, including object meta ID.

Organize the SD/HD in differentes folder but same name make things mutch easy:
/hd/main.png
/sd/main.png

You your artists insist in use the size as sufix, create a script that you cleanup it before update the atlas.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Atlas prefabs store source names instead of GUIDs
« Reply #2 on: September 10, 2013, 07:13:00 AM »
Exactly what sisso said -- don't use explicit info in the sprite names. Put them in different folders instead.