Version: 2020.2
Primitive and placeholder objects
Creando componentes desde scripting

2D Primitive GameObjects

Unity provides 2D Primitive GameObjects to help you prototype your Project quickly, without needing to import your own Assets. To create a 2D primitive, go to GameObject > 2D Object > Sprites and select one of the following options:

Default Sprite dimensions and pixels-per-unit

Most 2D primitives have a default Sprite size of 256 x 256 pixels, with a pixels-per-unit (PPU) size of 256, which makes their size equal to one unit in the Scene. The exceptions are the Capsule primitive, which is 256 x 512 pixels (1:2 units), and the Isometric Diamond primitive, which is 256 x 128 pixels (1:0.5 units).

Square

The Square 2D primitive is a white square that is 1x1 Unity units in size. You can use it as a placeholder for various elements, such as obstacles like crates, or to quickly create platforms. You can add the Box Collider 2D component to the GameObject to have it interact with other GameObjects and 2D physics. For a more scalable Sprite that resizes dynamically, you can select the 9-Sliced option instead.

Circle

The Circle 2D primitive is a white circle that is 1 Unity unit in diameter. You can use it as a placeholder for various types of elements in your Scene, such as obstacles or props like pick-ups or power-ups. You can add the Circle Collider 2D to the GameObject to have it interact with other objects and 2D physics.

Capsule

The Capsule 2D primitive is a white capsule that is 1x2 units in size. You can use this Capsule as a placeholder for various elements in your scene, such as an obstacle, prop, or as a stand-in for a character. You can add a Capsule Collider 2D to the GameObject to have it interact with other objects and 2D physics.

Isometric Diamond

The Isometric Diamond 2D primitive is a white diamond-shaped Sprite that is 1 x 0.5 units in size. This Sprite is designed to be used as a placeholder for Isometric Tilemaps. The pixels at the top and bottom of this Sprite are slightly cropped to improve tiling.

Hexagon Flat-Top

The Hexagon Flat-Top 2D primitive is a regular hexagon that is 1 unit wide, oriented with its sides to the top and bottom. It is designed to be used as a primitive Sprite placeholder for Tiles in Hexagonal Flat-Top Tilemaps. The pixels to the left and right of this Sprite are slightly cropped to improve tiling.

Hexagon Point-Top

The Hexagon Point-Top 2D primitive is a regular hexagon that is one unit tall, oriented with its points to the top and bottom. It is designed to be used as a primitive Sprite placeholder for Tiles in Hexagonal Pointed-Top Tilemaps. The pixels to the top and bottom of this Sprite are slightly cropped to improve tiling.

9-Sliced

The 9-Sliced 2D primitive is a white square with rounded corners that is 1x1 units in size. This Sprite has been 9-sliced with borders of 64 pixels on each side. It is designed to be used with the Sliced and Tiled draw modes on the Sprite Renderer. You can use the 9-sliced Sprite as a flexible placeholder for various elements in your Scene and Project (see 9-slicing Sprites for more information). You can add a Box Collider 2D with Auto Tiling enabled to have the Sprite interact with other objects and 2D physics.

Primitive and placeholder objects
Creando componentes desde scripting
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961