# Description A tool to help validate data across scenes, prefabs and scriptable objects. ![Editor Window](~Images/editor-window.png) ### Unity Windows ![Hierachy Window](~Images/editor-hierarchy-window.png) ![Project Window](~Images/editor-project-window.png) ## Component Validators ```csharp public sealed class ComponentValidatorMeshCollider : IComponentValidator { public void Validate(MeshCollider component, List results) { if (component.sharedMesh == null) results.Add(ValidatorResult.Create(EValidatorSeverity.Error, "Missing mesh")); } } ``` ## Attribute Validators The field attribute: ```csharp [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property, AllowMultiple = true)] public sealed class RequiredAttribute : Attribute { private readonly EValidatorSeverity _severity; public RequiredAttribute() { _severity = EValidatorSeverity.Error; } public RequiredAttribute(EValidatorSeverity severity) { _severity = severity; } } ``` The validator implements `IAttributeValidator`, where `T` is the attribute and will automatically be found by the validator. ```csharp public sealed class Validator : IAttributeValidator { public ValidatorResult Validate(RequiredAttribute attribute, object value) { var isValid = value is UnityEngine.Object obj ? obj != null : value != null; return isValid ? ValidatorResult.Valid : ValidatorResult.Create(attribute._severity, "Value is Null"); } } ```