The WithScale
method of the Transform
struct allows you to create a new Transform
instance with a specified 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 specified 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; Transform scaledTransform = originalTransform.WithScale(newScale); // The scaledTransform now has a uniform scale of 2.0, while retaining the original position and rotation.