Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: tylocook on January 31, 2014, 08:26:30 PM

Title: Creating Atlas and Sprites at Runtime [after 3.0]
Post by: tylocook on January 31, 2014, 08:26:30 PM
I was looking at this post (http://www.tasharen.com/forum/index.php?topic=4677.0) that discussed the ability to create an Atlas out of an array of Texture2D objects at runtime.

However, I found out that many of the techniques used in pulling it off have been deprecated from UIAtlas to the point where I am wondering if the ability to make an Atlas at runtime was essentially made unsupported.

Can anyone clarify if this is the case?

Thank you.

Edit: I just read about the existence of UITexture, but I am trying to leverage the single-draw call nature that a UIAtlas provides. I will have thousands of small textures that I am downloading at runtime and packing into a texture using Texture2D.PackTextures().
Title: Re: Creating Atlas and Sprites at Runtime [after 3.0]
Post by: ArenMook on February 01, 2014, 12:57:18 PM
Texture2D.PackTextures gives you one texture, and returns the list of rectangles in the same order that you fed in the textures.

You can still use UITexture to draw them. Just set the UV rect on each to be what you need it to be. Use the big texture.

UITextures using the same material will end up in the same draw call. No need to make an atlas.
Title: Re: Creating Atlas and Sprites at Runtime [after 3.0]
Post by: tylocook on February 03, 2014, 09:36:23 PM
Thanks, this worked great once I figured out how to do it. :D