The WithScale
method of the Transform
struct allows you to create a new Transform
instance with a modified uniform scale. This method is useful when you want to adjust the scale of an object while keeping its position and rotation unchanged.
The WithScale
method of the Transform
struct allows you to create a new Transform
instance with a modified uniform scale. This method is useful when you want to adjust the scale of an object while keeping its position and rotation unchanged.
To use the WithScale
method, call it on an existing Transform
instance and pass the desired scale as a float
. The method returns a new Transform
instance with the updated scale.
// Example of using the WithScale method Transform originalTransform = new Transform(); float newScale = 2.0f; // Create a new Transform with the updated scale Transform scaledTransform = originalTransform.WithScale(newScale); // The original transform remains unchanged // scaledTransform now has a uniform scale of 2.0