Hide
MinValue / MaxValue

Limit for number field. Support single number like int, float, and combo numbers like vector, color. Supported types are:

number types

  • int, uint, sbyte, byte, short, ushort,
  • long, ulong
  • float, double
  • decimal

combo types

  • Vector2, Vector2Int, Vector3, Vector3Int, Vector4
  • Quaternion
  • Color, Color32
  • Rect, RectInt
  • Bounds, BoundsInt
  • Custom type which has x, y, z, w properties, and they are all number types

Parameters

It accepts 1~6 parameters. For each parameter:

  1. If it's a number type, use that value
  2. If it's a string, use as callback. The callback must return either a number type, or null for no limit
  3. If it's null, then no limit for this number

For each parameter:

  • object position0=null: limit for first number. If it's number types, limit this number field. Otherwise, limit for:
    • x value for vector types, Quaternion, and rect types, and custom type
    • r value for color types
    • x value for Bounds.center and BoundsInt.position
  • object position1=null: limit for:
    • y value for vector types, Quaternion, and rect types, and custom type
    • g value for color types
    • y value for Bounds.center and BoundsInt.position
  • object position2=null: limit for:
    • z value for vector types, Quaternion, and custom type
    • width for rect types
    • b value for color types
    • z value for Bounds.center and BoundsInt.position
  • object position3=null: limit for:
    • w value for vector types, Quaternion, and custom type
    • height for rect types
    • a value for color types
    • x value for Bounds.extents and BoundsInt.size
  • object position4=null: limit for:
    • y value for Bounds.extents and BoundsInt.size
  • object position5=null: limit for:
    • z value for Bounds.extents and BoundsInt.size

Allow Multiple: Yes

using SaintsField; public int upLimit; [MinValue(0), MaxValue(nameof(upLimit))] public int min0Max; [MinValue(nameof(upLimit)), MaxValue(10)] public float fMinMax10;

Example:

// Color, but requires alpha=1 (no transparent) using SaintsField; [MinValue(position3: 255)] [MaxValue(position3: 255)] public Color32 color32NoAlpha; [MinValue(position3: 1)] [MaxValue(position3: 1)] public Color color32Alpha;

Example with callback field walk:

[MinMaxSlider(10, 20)] public Vector2Int heightRange; [MinValue(position3: nameof(heightRange) + ".x")] [MaxValue(position3: nameof(heightRange) + ".y")] public Rect rectHeightLimited;