mirror of https://github.com/tuyoogame/YooAsset
update extension sample
parent
36b4cbb8c2
commit
df8cf4d9ca
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 73ef838ec60c36249ba05eaa3c96273e
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,25 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using UnityEngine;
|
||||
using YooAsset.Editor;
|
||||
|
||||
[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);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 73aae15a0e1aec742a7e8f05755a2013
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Loading…
Reference in New Issue