Version: 5.3 (switch to 5.4b)
IdiomaEnglish
  • C#
  • JS

Idioma de script

Selecciona tu lenguaje de programación favorito. Todos los fragmentos de código serán mostrados en este lenguaje.

Rect.Rect

Cambiar al Manual
public Rect(float x, float y, float width, float height);

Parámetros

x The X value the rect is measured from.
y The Y value the rect is measured from.
width The width of the rectangle.
height The height of the rectangle.

Descripción

Creates a new rectangle.

          Rect rect = new Rect(0, 0, 10, 10);

Note: Rect represents an abstract rectangle, and can be used in a variety of situations. As such, Rects don't have an explicit top, bottom, left or right. For example, Y values in Camera space are measured from the bottom of the screen, but Y values in Editor GUI space are measured from the top of the window, therefore whether the Y value of a Rect is its "top" or "bottom" will vary depending on where you use the Rect value. You can refer to the corners by using Rect.min and Rect.max.


public Rect(Vector2 position, Vector2 size);

Parámetros

position The position of the minimum corner of the rect.
size The width and height of the rect.

Descripción

Creates a rectangle given a size and position.

This form of the constructor is convenient when you are already working with Vector2 values.