Added component validators
This commit is contained in:
parent
35f271e12b
commit
d7145ad772
30 changed files with 448 additions and 200 deletions
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue