Class CurveRangeAttribute
Attribute used to define a visible range for an AnimationCurve field in the Unity Inspector, including optional display color.
[AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)]
public class CurveRangeAttribute : PropertyAttribute
Inheritance
Examples
Example usage:
public class MyComponent : MonoBehaviour
{
// limit the visual range from (-1, -540f) to (1f, 540f)
[CurveRange(-1f, -540f, 1f, 540f, EColor.Orange)]
public AnimationCurve curve;
}
Constructors
CurveRangeAttribute(Vector2, Vector2, float, float, float, float)
Initializes the CurveRange with optional bounds and color.
public CurveRangeAttribute(Vector2 min, Vector2 max, float r = 0, float g = 1, float b = 0, float a = 1)
Parameters
| Name | Type | Description |
|---|---|---|
min | Vector2 | The minimum visible range of the curve. |
max | Vector2 | The maximum visible range of the curve. |
r | float | Red component of color (default 0). |
g | float | Green component of color (default 1). |
b | float | Blue component of color (default 0). |
a | float | Alpha component of color (default 1). |
Properties
Color
Optional color used to draw the curve background or bounds in the Inspector.
public Color Color { get; }