float UniformScale { get; set; }

book_4_sparkGenerated
code_blocksInput

Description

The UniformScale property of the Transform struct represents a uniform scaling factor applied to the transform. This property is a single floating-point value that is typically used when the scale is uniform across all axes. In such cases, the .x component of the scale vector is accessed to determine the uniform scale.

Usage

Use the UniformScale property when you need to apply or retrieve a uniform scale factor to a Transform object. This is particularly useful when the scale is the same across all dimensions, simplifying the manipulation of the transform's scale.

Example

// Example of setting and getting the UniformScale property

// Create a new Transform instance
Transform transform = new Transform();

// Set the uniform scale
transform.UniformScale = 2.0f;

// Retrieve the uniform scale
float scale = transform.UniformScale;

// Output the scale
// Note: Avoid using Console.WriteLine in s&box
// Instead, use the scale value in your game logic