- Home /
Question by
QuinnFreedman · Oct 13, 2016 at 07:00 AM ·
2dtilemapprocedural texturing
How can I dynamically create texture by stitching together sprites?
I want to procedurally generate a 2d tilemap without allocating a GameObject for each tile (I assume that's expensive). I've heard some people say to create a mesh for the whole level and texture it with one big texture.
But, I'm not sure how to create a texture from tiles.
I can create a texture like this:
var texture = new Texture2D (worldWidth * tileWidth, worldHeight * tileHeight, TextureFormat.ARGB32);
Texture2D has SetPixels
and LoadImage
and LoadRawTextureData
methods but as far as i can tell those all set the whole texture.
How can I set just parts of a texture from sprite data?
Comment