2D Toolkit Forum

2D Toolkit => Support => Topic started by: frozen on July 03, 2014, 09:49:34 am

Title: how to dynamic load Textures to sprite collection
Post by: frozen on July 03, 2014, 09:49:34 am
Hello Unikron,

I need to load some textures which are runtime download from game server. so that I can change user's avatar or other specify elements.
There is my thought:
1. load textures to Texture2D format.
2. create or use a exist spriteCollection to place these texture2ds by order.
3. use the collection to game.

In tk2d's demo code runtimespritecollection. there is only way to load a texture and parsetext way to create a collecton. although it is a good solution, but still don't match my need..

After search some posts in forum.
such that http://2dtoolkit.com/forum/index.php?topic=1525.0
still have some confuse in flow and specific code.
Could you show me a whole steps and elegant way to finish this need? :'(

thank you very much.
Title: Re: how to dynamic load Textures to sprite collection
Post by: unikronsoftware on July 03, 2014, 10:02:20 am
2D Toolkit doesn't do runtime atlasing. You will need to build your runtime atlas yourself, possibly using Texture2D.PackTextures. After you have the atlas packed, you can create a sprite collection as shown in the runtime sprite collection samples.
Title: Re: how to dynamic load Textures to sprite collection
Post by: frozen on July 03, 2014, 10:05:56 am
ps:
I want to place texture into spriteCollection not one time but many different time
that is a additional operate to collection ,just like use editor way.
Title: Re: how to dynamic load Textures to sprite collection
Post by: frozen on July 03, 2014, 10:06:59 am
sorry for the last post. just see the respones now
Title: Re: how to dynamic load Textures to sprite collection
Post by: frozen on July 03, 2014, 10:10:19 am
Thanks for that answer. That show me a great way to solve my problem. Coding and trying