[ValidateNotNull]
Validates that an object reference, string, or collection is not null or empty, displaying high-contrast alert banners directly in the Inspector and surfacing warnings in the Project Scanner.
1. Overview & Value Proposition
What it does: Eliminates null reference exceptions by asserting that field references are never left unassigned. It detects missing assets, empty strings, and zero-length arrays before you hit Play.
The Problem: Null references account for over 70% of runtime bugs in Unity projects. Standard Unity performs zero checks on unassigned fields in the inspector.
The Solution:
- Deep Null & Empty Detection: Setting
FailOnEmpty = trueadditionally catches empty string IDs and zero-element collections. - Direct Inspector Alerts: Renders high-contrast inline error cards.
- 1-Click Project-Wide Scan: The Validation Module window discovers all unassigned fields across the entire project in 1 click.
2. Quick Start Example
using UnityEngine;
using MaharajaStudio.MSUltimate.ValidationModule;
public class PlayerInventory : MonoBehaviour
{
[ValidateNotNull("Item database asset must be assigned.")]
public ScriptableObject itemDatabase;
[ValidateNotNull("Character display name cannot be null or empty.", FailOnEmpty = true)]
public string characterName = "Hero";
}
[ValidateRange]
Enforces minimum and maximum numeric boundaries on serialized fields, warning when values exceed safe design ranges and preventing out-of-bounds calculations.
1. Overview & Value Proposition
What it does: Guards numeric floats and integers against unrealistic or game-breaking values. Unlike basic Unity sliders which only cap UI dragging, [ValidateRange] also catches programmatic mutations, copy-pastes, and ScriptableObject overrides.
Validation Module Catalog (39 Total)
39 Validation Attributes & Scanner Staged
All 39 validation attributes and the project diagnostic window engine are staged inside assets/Documentations/MSUltimate/Addons/ValidationModule/Documentation/.