Search code examples
unity-game-enginecolorstextures

How to add a a get a simple flag with 3 stripes on a Cube in Unity


is there any way to give a simple 3D cube in Unity the look of a flag without displaying the whole flag on every side. So that as example the top stripe also fill's the whole top?


Solution

  • The default mesh unity provides for cubes always show the same texture an all6 sides, so they are always all the same. Whatever material/texture you apply.

    The one material is used an all sides, with UV values from 0 to 1 (whole texture).

    Even fiddling the UV scales on the material does not help as the 6 sides all start with the same range.

    I you wish to change this, you need to edit/create you own mesh for a cube which allows different UV settings for the 6 surfaces, or multiple materials. You could make one which has a second material for one of the 6 faces and assign your flag texture there.

    (Unity does not really provide mesh editing. I used blender for this.)

    In Unity, you could create an empty gameobject, add 6 'quad' objects, and use different textures on these. Then this set of 7 objects behaves like a cube, but with different textures (and less performance when using lots)

    Why not just use a single quad for the flag?