Added component validators

This commit is contained in:
Anders Ejlersen 2026-05-18 20:37:05 +02:00
parent 35f271e12b
commit d7145ad772
30 changed files with 448 additions and 200 deletions

View file

@ -9,7 +9,7 @@ namespace Module.ProjectValidator.Editor
{
public static T LoadFirstAsset<T>(string name) where T : Object
{
var guids = AssetDatabase.FindAssetGUIDs($"a:assets t:{typeof(T).Name} {name}");
var guids = AssetDatabase.FindAssetGUIDs($"t:{typeof(T).Name} {name}");
return guids.Length != 0 ? AssetDatabase.LoadAssetByGUID<T>(guids[0]) : null;
}

View file

@ -41,11 +41,15 @@ namespace Module.ProjectValidator.Editor
internal static string GetAttributeShortName(Attribute attribute)
{
var str = attribute.GetType().Name;
var index = str.IndexOf("Attribute", StringComparison.Ordinal);
if (index != -1)
str = str[..index];
str = str.Replace("Attribute", string.Empty);
str = ObjectNames.NicifyVariableName(str);
return str;
}
internal static string GetComponentValidatorShortName(object obj)
{
var str = obj.GetType().Name;
str = str.Replace("ComponentValidator", string.Empty);
str = ObjectNames.NicifyVariableName(str);
return str;
}