资源:Assets/GameContent/Scenes/ui_login.unity
AssetBundle name自动设置为: scenes/ui_login
using UnityEditor;
public class AssetsImportMgr : AssetPostprocessor
{
static void OnPostprocessAllAssets(
string[] importedAssets,
string[] deletedAssets,
string[] movedAssets,
string[] movedFromAssetPaths)
{
autoSetAssetBundleName(importedAssets);
}
static string[] ResSuffix = { ".unity", ".prefab" };
static string RootDir = "GameContent";
/// <summary>
/// 资源导入时自动设置AssetBundle name
/// </summary>
/// <param name="importedAssets"></param>
static void autoSetAssetBundleName(string[] importedAssets)
{
foreach (var path in importedAssets)
{
//是否GameContent目录下
int firstIndex = path.IndexOf(RootDir) + RootDir.Length + 1;