- Home /
Texture tiling for any object?
I have a texture that I want to put on multiple surfaces or objects. Say for example 2 cubes, one is 5 unites big and the other is 10. If I use the same texture on both cubes the texture would seem normal on one and bigger or smaller tiled on the other. I, therefore, need to duplicate the texture and fix the tiling. Can I make on texture than would look the same on every object I put it on? Without me having to duplicate it and fix the tiling.
Answer by Bunny83 · Oct 31, 2019 at 01:39 AM
Not directly with a default cube mesh as the UV coordinates of that mesh always map to the whole texture. So the lower left corner has the coordinates (0, 0) and the top right corner has the coordinates (1, 1).
You have several options.
First you don't need to duplicate the texture, only the material and change the tiling settings there. However you still need a seperate material for each cube. Both materials can use the same texture but require different tiling settings which is not optimal since every material represents a seperate draw call and can not be batched with other objects.
Another option is to actually create the different cubes in a modelling software and create the proper UV coordinates for them. So in your case if the cube is 5 units long and should have the texture 5 times on it, it would need the coordinates (0,0) / (0,1) on the left edge and (5,0) / (5,1) on the right edge assuming the cube is one unit in height and 5 units along the x axis.
Your third option and probably the best one is to use Unity's pro builder tools to create the meshes directly in Unity. You can simply add pro builder through the Unity package manager for free.