OdinInspectorValidationChecker

Use this class to collect all error and warning messages drawn by the GUI.

namespace Sirenix.Utilities.Editor
{
public static class OdinInspectorValidationChecker
}

Requirements

Namespace: Sirenix.Utilities.Editor
Assembly: Sirenix.OdinInspector
Version: 2.0.0.0

Static Fields

Return Type Definition Description
ImmutableHashSet<string> ErrorMessages The error messages gathered from the last validation check.
ImmutableHashSet<string> WarningMessages The warning messages gathered from the last validation check.

Static Properties

Return Type Definition Description
bool IsRunningValidationCheck Gets a value indicating whether or not a validation is running.

Static Methods

Return Type Definition Description
void BeginValidationCheck() Begins a validation check.
void EndValidationCheck() Begins a validation check.
void LogError(string) Logs an error if a validation check is currently running.
void LogWarning(string) Logs a warning if a validation check is currently running.

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);
}