Description
The Scale
property of the GameTransform
class represents the scale of the object in world coordinates. It is a Vector3
type, which means it contains three components: X, Y, and Z, each representing the scale factor along the respective axis.
Note: This property is marked as obsolete. It is recommended to use WorldScale
instead of Transform.Scale
for accessing or modifying the scale in world coordinates.
Usage
To access or modify the scale of a GameTransform
object, you can use the Scale
property. However, since this property is obsolete, it is advisable to use the WorldScale
property instead for future-proofing your code.
Example of accessing the scale:
Vector3 currentScale = myGameTransform.Scale;
Example of setting the scale:
myGameTransform.Scale = new Vector3(1.0f, 1.0f, 1.0f);
For new implementations, replace Scale
with WorldScale
to avoid using deprecated features.
Example
// Accessing the scale of a GameTransform object
Vector3 currentScale = myGameTransform.Scale;
// Setting the scale of a GameTransform object
myGameTransform.Scale = new Vector3(1.0f, 1.0f, 1.0f);
// Recommended usage with WorldScale
Vector3 currentWorldScale = myGameTransform.WorldScale;
myGameTransform.WorldScale = new Vector3(1.0f, 1.0f, 1.0f);