Added GameObject Validators
This commit is contained in:
parent
c8a6815316
commit
269789b36f
15 changed files with 160 additions and 13 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue