Added GameObject Validators

This commit is contained in:
Anders Ejlersen 2026-05-18 21:59:59 +02:00
parent c8a6815316
commit 269789b36f
15 changed files with 160 additions and 13 deletions

View file

@ -10,6 +10,7 @@ namespace Module.ProjectValidator.Editor
{
private readonly Dictionary<Type, object> _attributeValidators = new();
private readonly Dictionary<Type, List<object>> _componentValidators = new();
public readonly List<IGameObjectValidator> GameObjectValidators = new();
public void AddAttribute(Type type)
{
@ -59,6 +60,22 @@ namespace Module.ProjectValidator.Editor
}
}
public void AddGameObject(Type type)
{
if (type.IsInterface || type.IsAbstract)
return;
try
{
var instance = (IGameObjectValidator)FormatterServices.GetUninitializedObject(type);
GameObjectValidators.Add(instance);
}
catch (Exception e)
{
Debug.LogException(e);
}
}
public bool TryGetAttributeValidator(Type type, out object validatorInstance)
{
return _attributeValidators.TryGetValue(type, out validatorInstance);