Tasharen Entertainment Forum
Support => NGUI 3 Support => Topic started by: VamppiV on October 16, 2014, 08:38:09 AM
-
I'm looking for the easiest way to update atlas from script. I have UIAtlas and I want put dynamically new photos in. I was trying PackTextures but I wrapped up.
I want to do something easy like this:
public UIAtlas atlas;
Texture2D snap;
void OnClickedAtlasBlaBla(){
atlas.UPDATE(snap);
}
And I'm looking for something like update function. Any ideas?
-
I need it for do something like this:
newSprite.SetRect(x,y,texWidth,texHeight);
newSprite.atlas = atlas;
newSprite.spriteName=photoAddress;
And it works, but I don't know how to update (or make) atlas. I found class UIAtlasMaker, but I don't know how to use it.
-
Don't try to create atlases at run-time. If you need to pack many textures into one (and in most cases you don't need to), then just use a UITexture and specify a UV rect.
-
Don't try to create atlases at run-time. If you need to pack many textures into one (and in most cases you don't need to), then just use a UITexture and specify a UV rect.
Hm, okey, I remember. But what can I do if I'm making textures in runtime and I have to show them at one screen? It generetes a lot of drawcalls. UV rect? Any simple tutorial? Because I was trying and I completely didn't understand how does it work
-
NGUI batches everything by materials. You can have one large texture with many smaller inside of it. As long as you use the same material by your UITextures, they will all be drawn in the same draw call.