unity how to subtract from variable when the other is updated code example
Example: unity var not minus
void OnValidate()
{
theValue = Mathf.Clamp(theValue, 0, float.MaxValue); // or int.MaxValue, if you need to use an int but can't use uint.
}