Transform WorldTransform { get; set; }

robot_2Generated
code_blocksInput

Description

The WorldTransform property provides access to the world transform of the game object. This includes the position, rotation, and scale of the game object in the world space, as opposed to its local space relative to its parent.

Usage

Use the WorldTransform property to get or set the transform of a game object in the world space. This is useful when you need to manipulate or query the object's position, rotation, or scale in the context of the entire scene, rather than relative to its parent object.

Example

// Example of accessing the WorldTransform property
Component myComponent = someGameObject.GetComponent<Component>();
Transform worldTransform = myComponent.WorldTransform;

// Example of setting a new world position
worldTransform.Position = new Vector3(10, 0, 5);
myComponent.WorldTransform = worldTransform;