Class MaxValueAttribute
Sets a maximum value for the target field. Automatically prevents assigning a value greater than the specified value when editing the field in the inspector window
Inheritance
System.Object
System.Attribute
UnityEngine.PropertyAttribute
MaxValueAttribute
Implements
System.Runtime.InteropServices._Attribute
Inherited Members
UnityEngine.PropertyAttribute.order
Namespace: Atlas
Assembly: Atlas.Runtime.dll
Syntax
[AttributeUsage(AttributeTargets.Field, AllowMultiple = false)]
public sealed class MaxValueAttribute : PropertyAttribute, _Attribute
Examples
using UnityEngine;
namespace Atlas.Examples
{
public sealed class Example_MaxValueAttribute : MonoBehaviour
{
// prevents assigning values > 10 in the inspector
[SerializeField, MaxValue( 10.0f )] private float m_value;
}
}
Constructors
| Improve this Doc View SourceMaxValueAttribute(Single)
Constructor
Declaration
public MaxValueAttribute(float maxValue)
Parameters
Type | Name | Description |
---|---|---|
System.Single | maxValue | The maximum allowable value the field can have |
Properties
| Improve this Doc View SourceMaxValue
The maximum allowable value the field can have
Declaration
public float MaxValue { get; }
Property Value
Type | Description |
---|---|
System.Single |
Implements
System.Runtime.InteropServices._Attribute