Description
The WorldScale
property of a GameObject
represents the scale of the object in world coordinates. This property is crucial for understanding how the object is scaled relative to the entire scene, as opposed to its local scale which is relative to its parent object.
Usage
Use the WorldScale
property to get or set the scale of a GameObject
in world space. This can be useful when you need to adjust the size of an object based on global factors or when you need to ensure that an object maintains a specific size regardless of its parent hierarchy.
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 world scale to double its size in all dimensions
// Example of getting the WorldScale of a GameObject
Vector3 currentScale = myObject.WorldScale;
Console.WriteLine($"Current World Scale: {currentScale}");