UITransformComponent

The required Component to display UI Entity.

# Properties

[{"index":"PlatformType ActivePlatform (ReadOnly)","0":"Sets the platform on activating this UI."}]

[{"index":"AlignmentType AlignmentOption","0":"Indicates the anchor's reference point."}]

[{"index":"Vector2 anchoredPosition","0":"The center position of the UITransform relative to the anchor reference point."}]

[{"index":"Vector2 AnchorsMax","0":"Normalized position of the parent's UITransform where the upper-right corner is anchored."}]

[{"index":"Vector2 AnchorsMin","0":"Normalized position of the parent's UITransform where the lower-left corner is anchored."}]

[{"index":"Vector2 OffsetMax","0":"Deviation of the upper-right corner of the rectangle relative to the upper-right anchor."}]

[{"index":"Vector2 OffsetMin","0":"Deviation of the upper-right corner of the rectangle relative to the lower-left anchor."}]

[{"index":"Vector2 Pivot","0":"The normalized position when rotating the UI."}]

[{"index":"Vector2 RectSize","0":"Indicates the size of the UI."}]

[{"index":"UIModeType UIMode (ReadOnly)","0":"Indicates UI's current draw mode."}]

[{"index":"Vector3 UIRotation (HideFromInspector)","0":"Expresses rotation values as Euler angles."}]

[{"index":"Vector3 UIScale","0":"The relative size ratio of the UI."}]

##### inherited from TransformComponent:

[{"index":"Vector3 Position (Sync)","0":"Shows coordinates relative to an Entity's parent."}]

[{"index":"Quaternion QuaternionRotation (Sync) (HideFromInspector)","0":"Shows the rotation value of the Entity as a Quaternion."}]

[{"index":"Vector3 Rotation","0":"Represents the rotation value of the Entity in Euler angles. In 2D, rotate using the Z axis. Synchronized by QuaternitonRotation."}]

[{"index":"Vector3 Scale (Sync)","0":"Represents the size ratio of the Entity."}]

[{"index":"Vector3 WorldPosition","0":"Represents the world-related coordinates of an Entity."}]

[{"index":"Vector3 WorldRotation (HideFromInspector)","0":"Represents an Entity's world-related rotation value in Euler angles."}]

[{"index":"float WorldZRotation","0":"Represents the value of the Z axis among the Euler angle rotation values based on the Entity's world."}]

[{"index":"float ZRotation","0":"Represents the Z-axis value among the Euler angle rotation values of the Entity."}]

##### inherited from Component:

[{"index":"boolean Enable (Sync)","0":"Checks whether Component is activated or not."}]

[{"index":"boolean EnableInHierarchy (ReadOnly) (HideFromInspector)","0":"Displays whether this Component is Enable in the hierarchy. If Entity Enable is false regardless of Component Enable, returns false."}]

[{"index":"Entity Entity (ReadOnly)","0":"The Entity that owns this component."}]

# Methods

[{"index":"table GetWorldCorners()","0":"Convert the coordinates of the four vertices in the UI's rectangular area into the world coordinate system in order of lower left, upper left, upper right, and lower right and import as the array."}]

##### inherited from TransformComponent:

[{"index":"FastVector3 PositionAsFastVector3()","0":"Change the Position value to a FastVector3 type."}]

[{"index":"void Rotate(float angle)","0":"Rotate this Entity counterclockwise by angle."}]

[{"index":"Vector3 ToLocalDirection(Vector3 worldDirection)","0":"Converts the direction entered from world coordinates to local coordinates. It is not affected by scale or position."}]

[{"index":"Vector3 ToLocalPoint(Vector3 worldPoint)","0":"Converts world coordinates entered to local coordinates. It is affected by scale."}]

[{"index":"Vector3 ToWorldDirection(Vector3 localDirection)","0":"Converts the direction entered from local coordinates to world coordinates. It is not affected by scale or position."}]

[{"index":"Vector3 ToWorldPoint(Vector3 localPoint)","0":"Converts local coordinates entered to world coordinates. It is affected by scale."}]

[{"index":"void Translate(float deltaX, float deltaY)","0":"Move the coordinates of this Entity by deltaX, deltaY."}]

[{"index":"FastVector3 WorldPositionAsFastVector3()","0":"Change the WorldPosition value to a FastVector3 type."}]

##### inherited from Component:

[{"index":"boolean IsClient()","0":"Returns whether the current execution environment is a client or not."}]

[{"index":"boolean IsServer()","0":"Returns whether the current execution environment is a server or not."}]

# Events

[{"index":"UIModeTypeChangedEvent","0":"An event that occurs when the UIMode of UITransformComponent changes."}]

# Examples

This is an example of changing the size of a UI entity using StrecthAll. Using the value of OffsetMin and OffsetMax, you can introduce variations in the values of the top, bottom, left, and right offsets. When the size is decreasing, the color changes to red, and when the size is increasing, the color changes to green.
    
    
    @Component
    script UIExpandContractAnimator extends Component
        property number offset = 0
        property number dir = 1.0
    
        @ExecSpace("ClientOnly")
        method void OnUpdate(number delta)
        local offsetPerDelta = delta * 100.0 * self.dir
        self.offset = self.offset + offsetPerDelta
    
        if self.dir > 0 and self.offset >= 100 then
        	self.dir = -1.0
        elseif self.dir < 0 and self.offset <= 0 then
        	self.dir = 1.0
        end
    
        local uiTransform = self.Entity.UITransformComponent
        if uiTransform then
        	if uiTransform.AlignmentOption ~= AlignmentType.StretchAll then
        		uiTransform.AlignmentOption = AlignmentType.StretchAll
        		uiTransform.anchoredPosition = Vector2.zero
        		uiTransform.OffsetMax = Vector2.zero
        		uiTransform.OffsetMin = Vector2.zero
        	end
    
        	uiTransform.OffsetMin = Vector2(self.offset, self.offset)
        	uiTransform.OffsetMax = Vector2(-self.offset, -self.offset)
    
        end
    
        local guiRenderer = self.Entity.SpriteGUIRendererComponent
        if guiRenderer then
        	if self.dir > 0 then
        		guiRenderer.Color = Color.red
        		elseif self.dir < 0 then
        		guiRenderer.Color = Color.green
        	else
        		guiRenderer.Color = Color.white
        	end
        end
        end
    end
    

# SeeAlso

  * SpriteGUIRendererComponent
  * AlignmentType
  * Color
  * Vector2