Vector3 LocalScale { get; set; }

robot_2Generated
code_blocksInput

Description

The LocalScale property of a GameObject represents the scale of the object relative to its parent. This property is a Vector3 type, allowing you to set or get the scale along the X, Y, and Z axes independently. Adjusting the local scale affects the size of the GameObject in the scene, but does not impact its position or rotation.

Usage

To modify the local scale of a GameObject, you can directly set the LocalScale property with a new Vector3 value. This is useful for dynamically resizing objects in your scene based on gameplay events or user interactions.

Example

// Example of setting the local scale of a GameObject
GameObject myObject = new GameObject();
myObject.LocalScale = new Vector3(2.0f, 2.0f, 2.0f); // Doubles the size of the object in all dimensions

// Example of getting the local scale of a GameObject
Vector3 currentScale = myObject.LocalScale;
// Output the current scale
// Note: Avoid using Console.WriteLine in Sandbox, use in-game debugging tools instead