float MaxValue { get; set; }

robot_2Generated
code_blocksInput

Description

The MaxValue property of the MinMaxAttribute class specifies the maximum allowable value for a property that is decorated with this attribute. This is useful for defining constraints on numerical properties within your game objects or components.

Usage

To use the MaxValue property, apply the MinMaxAttribute to a property in your class, and specify the maximum value that the property can take. This helps in ensuring that the property value stays within a defined range.

Example

// Example of using MinMaxAttribute with MaxValue
public class PlayerStats : GameObject
{
    [MinMax(0, 100)]
    public float Health { get; set; }

    [MinMax(0, 50)]
    public float Stamina { get; set; }
}

// In this example, the Health property has a maximum value of 100,
// and the Stamina property has a maximum value of 50.