Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


xMax

The maximum x-coordinate value of the RectInt. This value is exclusive.
Read time 1 minuteLast updated 12 days ago

Definition

  • Type: Property
  • Namespace: UnityEngine
  • Assembly: UnityEngine.CoreModule
public int xMax { readonly get; set; }

Remarks

The RectInt.width is the difference between
xMax
and RectInt.xMin. If you set an
xMax
less than the current RectInt.xMin, then RectInt.width becomes negative.
xMax
and RectInt.xMin values are normalized prior to being returned such that
xMin
is always the smallest of the two values and
xMax
the largest. For example, a
RectInt
r
created as
RectInt r = new RectInt(0, 0, 10, 10);
and later assigned
r.xMax = -5
returns RectInt.width of -5, RectInt.xMin of -5, and
xMax
of 0. The
xMax
value is one greater than the largest x-coordinate contained in the
RectInt
. For example, a
RectInt
spanning x-coordinates 0–3 has an
xMax
of 4.