2D Toolkit Forum
2D Toolkit => Support => Topic started by: spanagiotis on June 24, 2014, 11:03:56 pm
-
I'm having a slight issue of finding a relatively easy way of changing sprite collections when using multiple platforms.
We have multiple sprite collections:
collection1_@1x
collection1_@2x
collection1_@4x
collection2_@1x
collection2_@2x
collection2_@4x
etc.
All the sprite collections hold the same types of sprites just a different variation. During gameplay the game may need to switch between sprite collections at anytime.
I know there is the SetSprite(...) command for each sprite but my difficulty is getting the tk2dSpriteCollectionData.
I need a list of all sprite collections that are in the build, but because the game could be using any of the three platforms, I'm unsure of how to go about this.
I know that if an asset is referenced and it's outside the resources folder Unity will automatically bundle the resource. I don't know if this is also true for the tk2d sprite collections. If it is, would it be bundling all the above mentioned collections with names in-tact into the resources area?
-
You should look into platform sprite collections to do this.
http://2dtoolkit.com/docs/latest/advanced/platform_specific_sprite_collections.html
It works around a lot of unity madness to make switching platforms bearable.
-
That's what we're currently using and it creates this folder and prefab structure - I've tried to create an example below. It's not that we're having trouble switching platforms, but knowing where the sprite collections are located and what their names are. We have 5 separate collections, so this structure repeats for each collection type.
-Collection 1
--collection1 (prefab)
--collection1 data
---collection1@1x (prefab)
---collection1@1x Data
---collection1@2x (prefab)
---collection1@2x Data
---collection1@4x (prefab)
---collection1@4x Data
same for collection2, collection3, etc.
Anytime during the game I may need to change the sprite collection of all sprites on screen to be another collection, so I'll need a list of references to all 5 collections sitting somewhere I can easily access. I was hoping there was a method somewhere in the tk2d files I could pass in the normal collection name (I.E collection1 without the @1x, @2x, @4x) and get back the appropriate tk2dSpriteCollectionData, but it doesn't seem like one exists.
In-addition, since the sprite collection must be located outside of the resources folder, I don't know if I'm guaranteed that, for example, collection 3 is included if nothing is referencing that collection.
Hopefully I'm making sense, I feel like my description is less than adequate.