2D Toolkit Forum

2D Toolkit => Support => Topic started by: mitralone on March 29, 2014, 05:46:28 am

Title: Creating Texture2D from diced atlas
Post by: mitralone on March 29, 2014, 05:46:28 am
Hello,

I need to get a single sprite from a collection and convert it to a Texture2D to post to facebook or twitter. My atlas is diced so I am not sure how to get it from the atlas.

Is there any way possible to get it from the mesh of the sprite or any export command to simply write the contents of the sprite into a Texture2D?

Thanks

Mitralone
Title: Re: Creating Texture2D from diced atlas
Post by: unikronsoftware on March 29, 2014, 11:49:18 am
Not directly, but you could create a render texture, draw the sprite into it and grab the pixels from there.
Title: Re: Creating Texture2D from diced atlas
Post by: mitralone on March 29, 2014, 08:38:40 pm
Well, thats a pro feature :) anything I can do with free version?
Title: Re: Creating Texture2D from diced atlas
Post by: unikronsoftware on March 29, 2014, 09:43:07 pm
Well you can create it but it will require reading a bunch of textures working out UVs and writing pixels out manually. Once you find the spriteDefinition sprite collection data, you will need to walk through all the quads work out the min and max uv values, then write that out into the final texture. This is doable, but a pain.