Added support to scan prefabs

This commit is contained in:
Anders Ejlersen 2026-05-19 20:15:30 +02:00
parent 269789b36f
commit 591693da1d
11 changed files with 159 additions and 62 deletions

View file

@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using System.Reflection;
using UnityEngine;
using UnityEngine.Pool;
namespace Module.ProjectValidator.Editor
{
internal sealed class GameObjectValidatorObsoleteComponents : IGameObjectValidator
{
public void Validate(GameObject gameObject, List<ValidatorResult> results)
{
using var _ = ListPool<Component>.Get(out var list);
gameObject.GetComponents(list);
for (var i = 0; i < list.Count; i++)
{
var type = list[i].GetType();
if (type.GetCustomAttribute(typeof(ObsoleteAttribute)) != null)
results.Add(ValidatorResult.Create(EValidatorSeverity.Warning, $"GameObject has obsolete '{type.Name}' component"));
}
}
}
}