Description
The Scale
field of the Transform
struct represents the scale of the transform in 3D space. It is a Vector3
type, allowing for non-uniform scaling along the x, y, and z axes. This field does not directly affect the Position
or Rotation
of the transform.
Usage
Use the Scale
field to adjust the size of an object in 3D space. You can set each component of the Vector3
individually to achieve non-uniform scaling, or set them all to the same value for uniform scaling.
Example
// Example of setting the scale of a Transform
Transform myTransform = new Transform();
myTransform.Scale = new Vector3(2.0f, 1.5f, 3.0f); // Non-uniform scaling
// Accessing the scale
Vector3 currentScale = myTransform.Scale;
// Setting uniform scale
myTransform.Scale = new Vector3(2.0f, 2.0f, 2.0f);