Version 2.1.0.0

OdinInspectorValidationChecker class

Namespace: Sirenix.Utilities.Editor
Assembly: Sirenix.Utilities.Editor
public static class OdinInspectorValidationChecker
Use this class to collect all error and warning messages drawn by the GUI.
Inheritance
  • System.Object
  • OdinInspectorValidationChecker
Example
Usage:
PropertyTree myPropertyTree;

OdinInspectorValidationChecker.BeginValidationCheck();
GUIHelper.BeginDrawToNothing();
InspectorUtilities.DrawPropertyTree(this.propertyTree, false, x => true); // Aggressively draws all properties even those hidden by attributes, foldouts, tabs etc...
GUIHelper.EndDrawToNothing();
OdinInspectorValidationChecker.EndValidationCheck();

var warningMessages = OdinInspectorValidationChecker.WarningMessages;
var errorMessages = OdinInspectorValidationChecker.ErrorMessages;
Example
A few GUI methods in SirenixEditorGUI such as ErrorMessageBox() and WarningMessageBox() already registers error and warnings messages when a OdinInspectorValidationChecker session is running. However you can easily register your own warning and error messages as well.
if (OdinInspectorValidationChecker.IsRunningValidationCheck)
{
    OdinInspectorValidationChecker.LogError(message);
    OdinInspectorValidationChecker.LogWarning(message);
}

Fields

ErrorMessages
The error messages gathered from the last validation check.
public static readonly ImmutableHashSet<string> ErrorMessages
WarningMessages
The warning messages gathered from the last validation check.
public static readonly ImmutableHashSet<string> WarningMessages

Properties

IsRunningValidationCheck
Gets a value indicating whether or not a validation is running.
public static bool IsRunningValidationCheck { get; }

Methods

BeginValidationCheck()
Begins a validation check.
public static void BeginValidationCheck()
EndValidationCheck()
Begins a validation check.
public static void EndValidationCheck()
LogError(String)
Logs an error if a validation check is currently running.
public static void LogError(string message)
Parameters
System.String message

The message.

LogWarning(String)
Logs a warning if a validation check is currently running.
public static void LogWarning(string message)
Parameters
System.String message

This website is brand new and built with the Odin 2.1 beta in mind. This means you might discover some features such as attribute expressions that are only available in the beta.

You can download the 2.1 beta from here and read the patch-notes here.