- Home /
2D sprites on the same plane with multiple textures
Hi,
I have a plane sized 500*500px and i want to assign a texture at XY 0, 0 on that plane and another texture at 0, 10 on the same plane and another one again on 10, 10 and so on... I also want to clear all the textures from that plane.
How can i do that in pure Unity code without any plugins?
I want to make a 2D game for iPhone & Android that consist of more than 100 cubes and doing them in separate planes each could result in more than 100 draw calls and could overload the CPU wouldnt it?
Im still interested on the way to achieve this.
Thanks.
Answer by Screenhog · Aug 15, 2012 at 06:42 PM
Well, there's texture tiling and offsets. In a material, the texture has a tiling value, which you can change as a value between 0 and 1 to change how the texture scales on an object, and an offset value, also between 0 and 1, which will change the placement of the texture. You can change these with SetTextureOffset and SetTextureScale.
However, you would probably be better of looking at sprite sheets. A sprite sheet is basically a texture with many small images on it, and is very useful for using large numbers of small images on mobile devices.