Hello Guest

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Mozgoid

Pages: [1]
1
Support / Re: Constantly "Rebuilding Index" - Probably VC related
« on: June 13, 2014, 12:55:01 pm »
Hello, may be my problem and it's solution will help somebody.

Situation:
In our game we had levels that full of various objects(sprites) that placed everywere. I have xml file that converted from psd file. This file have names and positions of objects. My task was write a script that reads that file and place right sprites in right positions. All this must be done in editor mode, and created objects will saved as prefab. Important : we defined platform specific sprite collections, for 1x and 2x platforms.

What i done:
Script has reference to tk2dSpriteCollectionData. He read sprite name from xml; find sprite collection that has definition of sprite with readed name; create  a sprite with right collection and name; add it to the scene.
Here structure of folders where placed sprite collections:
US/US_Objects_1_Data/US_Objects_1@1x_Data/US_Objects_1@1x  (generated tk2dSpriteCollectionData)
US/US_Objects_1_Data/US_Objects_1@1x_Data/atlas0
US/US_Objects_1_Data/US_Objects_1@1x_Data/atlas0 material
US/US_Objects_1_Data/US_Objects_1@2x_Data/US_Objects_1@2x  (generated tk2dSpriteCollectionData)
US/US_Objects_1_Data/US_Objects_1@2x_Data/atlas0
US/US_Objects_1_Data/US_Objects_1@2x_Data/atlas0 material

US/US_Objects_1_Data/US_Objects_1  (generated tk2dSpriteCollectionData)
US/US_Objects_1_Data/US_Objects_1@1x (generated tk2dSpriteCollection)
US/US_Objects_1_Data/US_Objects_1@2x (generated tk2dSpriteCollection)

US/US_Objects_1 (tk2dSpriteCollection)


Problem:
My script must have reference to tk2dSpriteCollectionData.
If I give him reference to US/US_Objects_1_Data/US_Objects_1 then it can't find any sprite.
If I give him reference to US/US_Objects_1_Data/US_Objects_1@1x_Data/US_Objects_1@1x , the script generate my map. Map look fine, but infinite "rebuiding index" starts when I select one of objects. Anyway I don't sure is it good to use platform specific data (US_Objects_1@1x) for generation

My solution:
Before generating a map I deleted platform 2x from sprite collections. And my folders became like this:
US/US_Objects_1_Data/US_Objects_1  (generated tk2dSpriteCollectionData)
US/US_Objects_1_Data/atlas0
US/US_Objects_1_Data/atlas0 material
US/US_Objects_1 (tk2dSpriteCollection)

In script I give reference to US/US_Objects_1_Data/US_Objects_1.  And generate map. Everything looks fine now. And now I can select any of generated objects. I save this as prefab. And after that I add platform 2x to sprite collection. As result I get generated map that uses platform specific sprites.

May be all this is very specific, but I hope I help  somebody. Sorry for my English :)

Pages: [1]