Search code examples
unity-game-enginerectunity3d-2dtools

Simple rectangle in Unity3D


There's plenty of tutorials which explain how to add and manage image objects. But what if I want to add simple rectangle with plain white color? May I do it similar to adding 3D objects? I see no rectangle option under 2D Object in GameObject menu.

I know that I may do it by script, but isn't there any simpler solution? Or maybe I should use 3D Object Cube instead?


Solution

  • For a rectangle (ie a 2D cuboid) you add a 3D object that is a Quad which is a 3D object with a size of 0 in one plane, in effect making it a 2D sheet.

    See also: http://docs.unity3d.com/Manual/PrimitiveObjects.html

    Quads are most often used as backdrops to 2D games. Once you have the quad you can then change its material properties to set it as a single plain colour.