Skip to content

About

Free inspector attributes for Unity [Custom Editor, Custom Inspector, Inspector Attributes, Attribute Extensions]

Topics

Resources

Stars

1.5k stars

Watchers

24 watching

Forks

Latest commit

 

History

435 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tri Inspector 2.0 Github license Unity 6000.0 GitHub package.json version openupm

Advanced inspector attributes for Unity

How to Install

Library distributed as git package (How to install package from git URL)
Git URL: https://github.com/codewriter-packages/Tri-Inspector.git

Localization package dependency
Tri Inspector automatically installs Localization package as dependency.
If you are not using localization package and do not want to install it, you can install a stub package instead.
Git URL: https://github.com/codewriter-packages/Unity-Localization-Stub-for-Tri-Inspector.git

What's New in 2.0-preview

Warning

2.0 is currently a preview release and may contain bugs. If you run into any issues, please report them. If you need a stable experience, install the latest 1.x.x release from the 1.x.x branch.

Tri Inspector 2.0 is a significant milestone — rebuilt from the ground up on Unity's UI Toolkit, bringing a modern foundation, polished visuals, and long-requested features.

  • 🎯 Unity 6 and above — minimum supported version is now Unity 6, allowing the project to adopt modern editor APIs without legacy baggage.
  • 🖼️ UI Toolkit based — the entire rendering pipeline has been rewritten using UI Toolkit, replacing the old IMGUI backend.
  • 📦 Prefab workflow support — Tri Inspector fully respects Unity's prefab override system, so modified properties are highlighted, revertable, and apply correctly across prefab instances and variants.
  • ✨ New styles for UI elements — lists, groups, info boxes now have polished, consistent visual styles that not only integrate with Unity 6's editor theme, but redefine what an editor inspector can look like.
  • 🛠️ Overall improvements and bug fixes — a wide range of edge-case bugs have been resolved and internal systems have been hardened, resulting in a more stable and predictable inspector experience.
  • ↕️ TableList is now reorderable — rows in [TableList] can be dragged and reordered directly in the inspector, making list management significantly faster.
  • 📖 Dictionary support — dictionaries can now be displayed and edited in the inspector across all supported Unity versions. Starting from Unity 6.6, dictionaries are also fully serializable by Unity itself.
  • 🔍 Tri Project Validator — a brand-new validation window that runs every Tri attribute across your whole project, keeping it valid as you work and in CI. See Tri Project Validator below.
Tri-Inspector-Demo

Tri Project Validator

The same validation attributes that power the inspector now drive a dedicated Tri Validator window that checks your whole project. Open it from Tools/Tri Inspector/Validator.

  • ✅ Keep your project valid — all issues are collected into one navigable tree so you can find and fix them before they ship.
  • 🗂️ Validate the entire project — scan all assets and scenes in one pass, with configurable scope.
  • ⚡ Live validation while you work — results stay current in the background as you edit, no manual rescan needed.
  • 🌳 Hierarchy integration — on Unity 6.6+, validation hooks into the new Hierarchy window as dedicated error and warning columns, showing per-GameObject issue counts right where you work (while the Tri Validator window is open).
  • 🤖 CI/CD and Agents ready — run a headless validation from code via TriValidator.ValidateProjectAsJson() to fail the build when issues slip in. When Unity Pipeline is installed, validation is also exposed as Pipeline CLI commands, so an AI agent can run it and act on the JSON report:
    • unity command tri validate_project — validate every in-scope asset and scene
    • unity command tri validate_scenes — validate the currently open scenes
    • unity command tri validate_asset --global_id <id> — validate a single asset by its globalId
Tri-Validator-Demo

Samples

TriInspector ships with a built-in Samples Window — your interactive playground for every attribute in the package. Open it from Tools/Tri Inspector/Samples and browse all attributes organized by category. Select any sample to instantly see a live inspector with real fields, so you can explore exactly how each attribute looks and behaves without writing a single line of code.

Each sample also displays its full source code right in the window, so you can see exactly how the attribute is used and copy it straight into your project. It's the fastest way to discover what TriInspector can do and understand how to apply it.

Samples

Popular attributes

TriInspector comes packed with a huge collection of attributes — far too many to cover here in full. Below are some of the most frequently used ones to get you started. For the complete list, open the Samples Window.

ShowInInspector

Shows non-serialized property in the inspector.

ShowInInspector

ReadOnly

Makes property non-editable in the inspector.

ReadOnly

Required

Marks a field as required and shows an error in the inspector when it is not assigned. Supports an optional fix action — a custom method that can perform any logic to resolve the issue, such as finding and assigning the missing reference automatically.

Required

ValidateInput

Runs a custom validation method whenever the field value changes and displays the result as an error or warning directly in the inspector.

ValidateInput

InfoBox

Displays a static or dynamic message box above a property with configurable severity — info, warning, or error.

InfoBox

Dropdown

Replaces a field's default input with a dropdown list of predefined values. Values can be static constants or generated dynamically at runtime.

Dropdown

Scene

Renders a string field as a scene picker dropdown populated from the project's build settings, eliminating typos and making scene references refactor-safe. TriInspector also includes other specialized field drawers of this kind, such as [Layer] for layer selection, [AnimatorParameter] for Animator parameters, [MaterialProperty] for shader properties, and more.

Scene

Slider

Renders a numeric field as a slider with configurable fixed or dynamic min and max bounds, giving designers an intuitive range control instead of a raw number input.

Slider

MinMaxSlider

Renders a Vector2 field as a min-max range slider, letting you define both the lower and upper bound of a range with a single intuitive control.

MinMaxSlider

InlineEditor

Embeds the full inspector of a referenced asset inline within the parent inspector, so you can view and edit nested assets without leaving the current selection.

InlineEditor

Preview Mesh

Shows an interactive 3D mesh preview below a GameObject field directly in the inspector, making it easy to visually verify the right mesh is assigned.

Preview Mesh

Title

Draws a bold header line above a property or button in the inspector, making it easy to visually separate and label sections of a large component.

Title

TableList

Renders a list or array as a compact multi-column table in the inspector, with support for drag reordering and custom column sizes — perfect for large structured datasets.

TableList

Groups

Properties can be grouped in the inspector using the [Group] attribute. TriInspector supports six group types, each declared on the class with a corresponding [Declare*Group] attribute:

  • BoxGroup — wraps properties in a titled or untitled box
  • FoldoutGroup — collapses properties behind a foldout toggle
  • ToggleGroup — a foldout with a built-in enable/disable toggle
  • TabGroup — organises properties into named tabs, showing one at a time
  • HorizontalGroup — lays properties out side by side in a row
  • VerticalGroup — stacks properties vertically, typically nested inside a horizontal group

Groups can be freely nested and combined to build complex, multi-region inspector layouts.

BoxGroup

FoldoutGroup

ToggleGroup

TabGroup

HorizontalGroup

VerticalGroup

Extending Tri Inspector

Tri Inspector uses a unified extensibility model — the same validators, drawers and processors that power the built-in attributes are available to you. Everything shipped in the package is written against the same base classes you extend, so your extensions work everywhere, including the Tri Project Validator. Each extension is a class marked with a registration attribute and discovered automatically.

Unified validation system

Validation is a shared pipeline you can plug into at two levels:

  • TriValueValidator<T> — validate every property of a given type T. Register with [RegisterTriValueValidator].
  • TriAttributeValidator<TAttribute> — validate properties marked with your own attribute TAttribute. Register with [RegisterTriAttributeValidator].
[RegisterTriAttributeValidator]
public class NotEmptyValidator : TriAttributeValidator<NotEmptyAttribute>
{
    public override TriValidationResult Validate(TriProperty property)
    {
        if (string.IsNullOrEmpty(property.Value as string))
            return TriValidationResult.Error($"{property.DisplayName} must not be empty");

        return TriValidationResult.Valid;
    }
}

Every result you return appears both inline in the inspector and in the project-wide Tri Validator window.

Custom drawers

You can control how a property is rendered at two levels:

  • TriValueDrawer<T> — draw every property of type T. Use this to provide a custom UI Toolkit element for your own serializable types.
  • TriAttributeDrawer<TAttribute> — draw or decorate properties marked with your attribute TAttribute, with typed access to the attribute via Attribute. Use TriDrawerOrder to control whether your drawer replaces the field, decorates it, or wraps the whole inspector element.
[RegisterTriAttributeDrawer(TriDrawerOrder.Drawer)]
public class MyAttributeDrawer : TriAttributeDrawer<MyAttribute>
{
    public override VisualElement CreateVisualElement(TriProperty property, VisualElement next)
    {
        // return your own UI Toolkit VisualElement
    }
}

Register value drawers with [RegisterTriValueDrawer] and attribute drawers with [RegisterTriAttributeDrawer].

Type processors

For the most advanced cases, TriTypeProcessor operates at the structural level, before any drawing happens. A processor receives a type and the list of TriPropertyDefinitions being built for it, so you can add, remove, reorder or inject properties. This is the same mechanism Tri Inspector uses internally to gather fields, properties and buttons. Register with [RegisterTriTypeProcessor(order)], where order controls when your processor runs relative to the built-in ones.

[RegisterTriTypeProcessor(10000)]
public class MyTypeProcessor : TriTypeProcessor
{
    public override void ProcessType(Type type, List<TriPropertyDefinition> properties)
    {
        // inspect and modify the property definitions for `type`
    }
}

Examples

Every built-in attribute is implemented with these same extension points, so the package source is the best reference. Browse the implementations here:

License

Tri-Inspector is MIT licensed.

About

Free inspector attributes for Unity [Custom Editor, Custom Inspector, Inspector Attributes, Attribute Extensions]

Topics

Resources

Stars

1.5k stars

Watchers

24 watching

Forks

Releases

Used by

Contributors

Languages