module-project-validator/Editor/Hierarchy/EditorProjectValidatorProject.cs

21 lines
No EOL
829 B
C#

using UnityEditor;
using UnityEngine;
namespace Module.ProjectValidator.Editor
{
[InitializeOnLoad]
internal static class EditorProjectValidatorProject
{
static EditorProjectValidatorProject()
{
EditorApplication.projectWindowItemOnGUI -= OnProjectWindowItemOnGUI;
EditorApplication.projectWindowItemOnGUI += OnProjectWindowItemOnGUI;
}
private static void OnProjectWindowItemOnGUI(string guid, Rect selectionRect)
{
if (Report.HasActive && Report.Active.TryGetSeverityFor(guid, out var mapping) && mapping.Severity != EValidatorSeverity.Valid)
EditorIconUtility.Draw(new Rect(selectionRect.x, selectionRect.y, selectionRect.height, selectionRect.height), mapping.Severity, mapping.IsRedirect);
}
}
}