GameTransform Transform { get; set; }

robot_2Generated
code_blocksInput

Description

The Transform property provides access to the transform of the GameObject that this component is attached to. Components themselves do not have their own transforms, but they can access the transform of their parent GameObject. This property serves as a convenient shortcut for accessing GameObject.Transform.

Usage

Use the Transform property when you need to manipulate or query the position, rotation, or scale of the GameObject that a component is attached to. This property is read-only and provides a GameTransform object, which can be used to perform various transformations.

Example

// Example of accessing the Transform property in a component
public class MyComponent : Component
{
    public void MoveGameObject(Vector3 newPosition)
    {
        // Access the Transform property to set a new position
        Transform.Position = newPosition;
    }

    public void RotateGameObject(Rotation newRotation)
    {
        // Access the Transform property to set a new rotation
        Transform.Rotation = newRotation;
    }
}