Select your preferred scripting language. All code snippets will be displayed in this language.
Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.
CloseCreates a new rectangle.
var rect = Rect (0, 0, 10, 10);
using UnityEngine; using System.Collections;
public class ExampleClass : MonoBehaviour { public Rect rect = new Rect(0, 0, 10, 10); }
position | The position of the top-left corner. |
size | The width and height. |
Creates a rectangle given a size and position.
This form of the constructor is convenient when you are already working with Vector2 values.