Component:RectTransform: Difference between revisions

From Resonite Wiki
Added an information note.
add warning
 
(One intermediate revision by the same user not shown)
Line 9: Line 9:
<!--T:2-->
<!--T:2-->
The '''RectTransform''' component defines what space a slot with [[UIX]] components on it will use, based on the total amount of space that has been provided. This is mostly used to encapsulate elements with inside it, then provides options to anchor, offset, and pivot the placement of the RectTransform container.
The '''RectTransform''' component defines what space a slot with [[UIX]] components on it will use, based on the total amount of space that has been provided. This is mostly used to encapsulate elements with inside it, then provides options to anchor, offset, and pivot the placement of the RectTransform container.
{{Note|When smoothly changing this component's values it will not act with the intended effect. Use [[Component:RectTransformLerp]] instead.|warning}}


<!--T:3-->
<!--T:3-->
== Fields ==
{{Table ComponentFields
{{Table ComponentFields
|AnchorMin|Float2|The normalized position (0 to 1) in the parent object that the lower left corner is anchored to.
|AnchorMin|Float2|The normalized position (0 to 1) in the parent object that the lower left corner is anchored to.
Line 32: Line 35:


<!--T:6-->
<!--T:6-->
== Related Components ==
== See Also ==
The [[Component:RectTransformComputedProperties|RectTransformComputedProperties]] component is useful when using this component as a reference, returning you the size of the actual rect transform for your calculations.
The [[Component:RectTransformComputedProperties|RectTransformComputedProperties]] component is useful when using this component as a reference, returning you the size of the actual rect transform for your calculations.


</translate>
</translate>
[[Category:Components{{#translation:}}|Rect Transform]]
[[Category:Components{{#translation:}}|Rect Transform]]
[[Category:ComponentStubs]]
[[Category:Components:UIX{{#translation:}}|Rect Transform]]
[[Category:Components:UIX{{#translation:}}|Rect Transform]]

Latest revision as of 06:37, 22 February 2025

Component image 
RectTransform component as seen in the Scene Inspector


The RectTransform component defines what space a slot with UIX components on it will use, based on the total amount of space that has been provided. This is mostly used to encapsulate elements with inside it, then provides options to anchor, offset, and pivot the placement of the RectTransform container.

When smoothly changing this component's values it will not act with the intended effect. Use Component:RectTransformLerp instead.

Fields

Fields
Name Type Description
persistent Bool Determines whether or not this item will be saved to the server.
UpdateOrder Int Controls the order in which this component is updated.
Enabled Bool Controls whether or not this component is enabled. Some components stop their functionality when this field is disabled, but some don't.
AnchorMin Float2 The normalized position (0 to 1) in the parent object that the lower left corner is anchored to.
AnchorMax Float2 The normalized position (0 to 1) in the parent object that the upper right corner is anchored to.
OffsetMin Float2 The offset of the lower left corner of the rectangle relative to the lower left anchor, in pixels.
OffsetMax Float2 The offset of the upper right corner of the rectangle relative to the upper right anchor, in pixels.
Pivot Float2 The normalized position in this rectangle that it rotates around.

Usage

This can be used for placements inside your canvas or other upper elements, for your images or other lower elements for this container component.

When attempting to duplicate a RectTransform, the new RectTransform will remove itself from the slot.

Examples

Here is a video from ProbablePrime's tutorial on RectTransforms:

See Also

The RectTransformComputedProperties component is useful when using this component as a reference, returning you the size of the actual rect transform for your calculations.