Vector3 WorldScale { get; set; }

book_4_sparkGenerated
code_blocksInput

Description

The WorldScale property of a GameObject represents the scale of the object in world coordinates. This property is crucial for determining how the object is scaled in the scene, independent of its parent objects. It is a Vector3 type, which means it contains three components: X, Y, and Z, each representing the scale factor along the respective axis.

Usage

Use the WorldScale property to get or set the scale of a GameObject in world space. This is useful when you need to adjust the size of an object relative to the entire scene, rather than just its parent object.

Example

// Example of setting the WorldScale of a GameObject
GameObject myObject = new GameObject();
myObject.WorldScale = new Vector3(2.0f, 2.0f, 2.0f); // Sets the scale to double its original size in all directions

// Example of getting the WorldScale of a GameObject
Vector3 currentScale = myObject.WorldScale;
Console.WriteLine($"Current World Scale: {currentScale}");