Added support to scan prefabs
This commit is contained in:
parent
269789b36f
commit
591693da1d
11 changed files with 159 additions and 62 deletions
|
|
@ -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"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue