Transform WorldTransform { get; set; }

robot_2Generated
code_blocksInput

Description

The WorldTransform property of a GameObject provides the transform of the object in world space. This includes its position, rotation, and scale relative to the world, rather than its parent object.

Usage

Use the WorldTransform property to get or set the transform of a GameObject in world coordinates. This is useful when you need to position or orient the object in the global scene, independent of its parent hierarchy.

Example

// Example of accessing the WorldTransform property
GameObject myObject = new GameObject();
Transform worldTransform = myObject.WorldTransform;

// Modify the world position
worldTransform.Position = new Vector3(10, 0, 5);

// Apply the modified transform back to the GameObject
myObject.WorldTransform = worldTransform;