mirror of https://github.com/tuyoogame/YooAsset
Merge 9e2030c83d
into e76a782a80
commit
b327f5aa09
|
@ -40,4 +40,23 @@ namespace YooAsset.Editor
|
||||||
return $"{fileInfo.Directory.Name}_{fileName}";
|
return $"{fileInfo.Directory.Name}_{fileName}";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[DisplayName("定位地址: 文件名.智能尾缀")]
|
||||||
|
public class AddressByFileNameAndExt : IAddressRule
|
||||||
|
{
|
||||||
|
public string GetAssetAddress(AddressRuleData data)
|
||||||
|
{
|
||||||
|
var ext = Path.GetExtension(data.AssetPath);
|
||||||
|
if (ext == ".asset")
|
||||||
|
{
|
||||||
|
var a = UnityEditor.AssetDatabase.LoadAssetAtPath<UnityEngine.Object>(data.AssetPath);
|
||||||
|
if (a == null) return ".errortype";
|
||||||
|
var type = a.GetType();
|
||||||
|
var dt = Path.GetFileNameWithoutExtension(data.AssetPath);
|
||||||
|
return dt + $".{type.Name.ToLowerInvariant()}";
|
||||||
|
}
|
||||||
|
|
||||||
|
return Path.GetFileName(data.AssetPath);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue