UGTK cat mascotUGTKengine within an engine Request access

UGTK / Toolkit / Utility Systems / Range System Completed

Utility Systems — UGTK

Range System

Summary

An extension of the Counter system: it classifies the counter's CurrentValue into a list of non-overlapping inclusive bands and invokes the UnityEvent<int> of the first matching band, passing the value. Overlaps are auto-corrected in the editor.


Content


Modules Dependencies


Setup

Drop the Range prefab into the scene — a GameObject with Mn_Range (counter + bands) ready to configure:


How To Use

  1. Add Mn_Range to a GameObject (it is a Mn_Counter, so it has all counter fields plus the range bands).
  2. Fill the ranges list; each S_Range has min, max and an onMatched (UnityEvent<int>). Bands are treated as inclusive and must not overlap.
  3. Configure behaviour:
  4. verifyRangeWhenCounterChanges (default true): every time CurrentValue changes, VerifyRange() runs automatically.
  5. axisVisualMin: the lower end of the numeric axis drawn by the custom editor (independent from counter clamping); AxisVisualMax mirrors MaxValue.
  6. Call VerifyRange() (or let the counter change trigger it): it normalizes each band (min ≤ max), and invokes the onMatched of the first band that contains CurrentValue, then returns. If any two bands overlap it logs an error and does nothing.

In the Editor, OnValidate normalizes bands, pushes overlapping bands forward to keep them exclusive, and enforces axisVisualMin / MaxValue bounds from the first/last band.

Good to know:


Testing Scene

Open Debug/RangeScene.unity and press Play: increment the counter from the inspector and watch the band events fire as the value crosses from one range to the next.


Technical Info


© 2026 Marcello De Bonis. All rights reserved

Real dependenciesOpen in the map →

Depends on 1

Used by 0

  • No other module depends on it.

Measured from the repository: code references (asmdef) plus prefab and asset GUIDs. Importing this module alone brings in 2 modules in total.