Scripting API

Rect

struct in UnityEngine · UnityEngine.CoreModule

26 of 26 of Unity's membersUnity's documentation
In Tassix

Axis-aligned 2D rectangle (x/y is the min corner). Contains excludes the max edge; Overlaps is strict. Verified in conformance/recordings/value_types.jsonl.

Constructors 1

Rect(float x, float y, float width, float height)
Rect(Vector2 position, Vector2 size)
Rect(in Vector2 position, in Vector2 size)
Rect(Rect source)
Rect(in Rect source)

Properties 14

Vector2 center { get; set; }
float height { get; set; }
Vector2 max { get; set; }
Vector2 min { get; set; }
Vector2 position { get; set; }
Vector2 size { get; set; }
float width { get; set; }
float x { get; set; }
float xMax { get; set; }
float xMin { get; set; }

Setting moves the min edge and keeps the max edge.

float y { get; set; }
float yMax { get; set; }
float yMin { get; set; }
static Rect zero { get; }

Methods 9

bool Contains(Vector2 point)
bool Contains(in Vector2 point)
bool Contains(Vector3 point)
bool Contains(in Vector3 point)
bool Contains(Vector3 point, bool allowInverse)
bool Contains(in Vector3 point, bool allowInverse)
bool Equals(Rect other)
bool Equals(in Rect other)
bool Equals(object? other)
int GetHashCode()
static Rect MinMaxRect(float xmin, float ymin, float xmax, float ymax)
static Vector2 NormalizedToPoint(Rect rectangle, Vector2 normalizedRectCoordinates)
static Vector2 NormalizedToPoint(in Rect rectangle, in Vector2 normalizedRectCoordinates)
bool Overlaps(Rect other)
bool Overlaps(in Rect other)
bool Overlaps(Rect other, bool allowInverse)
bool Overlaps(in Rect other, bool allowInverse)
static Vector2 PointToNormalized(Rect rectangle, Vector2 point)
static Vector2 PointToNormalized(in Rect rectangle, in Vector2 point)
void Set(float x, float y, float width, float height)
string ToString()
string ToString(string? format)
string ToString(string? format, IFormatProvider? formatProvider)

Operators 2

static bool operator !=(Rect lhs, Rect rhs)
static bool operator ==(Rect lhs, Rect rhs)