Getting started with Odin Project Validator


The purpose of Odin Validator is to make it as effortless as possible to keep everything in your project set up correctly. It's very easy for errors to creep in over time, especially as project requirements and code changes, leaving old data obsolete. It can also be difficult for designers and new team members to know how to set up data correctly in the inspector. Specifying the valid characteristics of your data and getting easy feedback in the inspector, as well as when you run a full project scan, can be immensely helpful.

The validator can help you set up rules for your scenes, prefabs, scriptable objects, textures, project-settings and more.

To get started with Odin Validation and run a validation profile, go to Tools > Odin Project Validator, select a profile to run, and click the green "Run X" button in the top right, where X is the name of the profile. The validator will run a scan using the profile, and then present the results to you. You can view all scanned objects in the left tree view, and you can view all results in the bottom result overview, which is searchable, and sortable by column. The right part of the window displays the relevant scanned object for the currently selected result or tree view entry, for quick and easy editing.

That's all there is to it! Now you can easily go through all the validation results, and make any corrections that are needed.

Validating ScriptableObjects and Components

Odin Validator comes with built-in support for the following validation attributes.

An example of a properly validated component might look like this:

public class MyComponent : MonoBehaviour
{
    [Required]
    public string Name;

    [AssetsOnly, AssetSelector, Required]
    public GameObject Prefab;

    [ChildGameObjectsOnly, Required]
    public GameObject Child;

    [ValidateInput("@OddNumber % 2 == 1", "@OddNumber + \" is too normal!\"")]
    public int OddNumber;
}

When used diligently throughout your project, Odin Project Validator makes it easier to onboard new team members, and helps keeps your project stable as it grows and changes.

Learn more about how to use Odin Project Validator:

Create your own validators

Create your own validators to add custom validation attributes or define global project-wide rules for how your project should be set up.

Creating custom validators

Validation profiles explained

Run various validation profiles to stay on top of your project, however complex it grows.


Odin Validation Profiles explained

Running a validation profile from code

Integrate project validation into your own code. Run it from your custom build process, from your testing framework, on your build serve,r or wherever else you want to.

Running a Validation Profile from code

Creating a custom validation profile

Learn to create your own custom validation profiles to suit your project's exact needs, however exotic they may be.


Creating a custom Validation Profile