Unity 6.3
0 онлайн 26 гостей 3 в системе
Вход

RectTransform.rect

Declaration

public Rect rect;

Описание

Расчетный прямоугольник в локальном пространстве Transform.

Unity автоматически прикрепляет их к элементам UI. Манипулируйте аспектами прямоугольника в Inspector, такими как положение, размеры, вращение и масштаб. Это только для чтения в скрипте.

using UnityEngine;

public class Example : MonoBehaviour { RectTransform rectTransform;

void Start() { //Fetch the RectTransform from the GameObject rectTransform = GetComponent<RectTransform>(); }

void OnGUI() { //The Label shows the current Rect settings on the screen GUI.Label(new Rect(20, 20, 150, 80), "Rect : " + rectTransform.rect); } }