[MenuItem("ILFrameWork/Prefab rename", false, 10)]
static void reboot_rename()
{
setPrefabname("xxx");
}
static void setPrefabname(string xxx)
{
foreach (var obj in Selection.GetFiltered<UnityEngine.Object>(SelectionMode.Assets))
{
var path = AssetDatabase.GetAssetPath(obj);
if (string.IsNullOrEmpty(path))
continue;
if (System.IO.File.Exists(path))
{
int idx = path.LastIndexOf(".");
if (idx != -1)
{
int len = path.Length - idx;
string rename = path.Substring(0, path.Length - len);
rename = xxx + rename;
AssetImporter assetImporter = AssetImporter.GetAtPath(path);
assetImporter.assetBundleName = rename;
Debug.Log(rename);
}
}
}
}
[MenuItem("ILFrameWork/Prefab name copy", false, 10)]
static void namecopy()
{
foreach (var obj in Selection.GetFiltered<UnityEngine.Object>(SelectionMode.Assets))
{
var path = AssetDatabase.GetAssetPath(obj);
if (string.IsNullOrEmpty(path))
continue;
AssetImporter assetImporter = AssetImporter.GetAtPath(path);
string fullname = assetImporter.assetBundleName + "." + assetImporter.assetBundleVariant;
TextEditor t = new TextEditor();
t.text = fullname;
t.OnFocus();
t.Copy();
Debug.Log("名称已经复制到粘贴板 : "+ fullname);
}
}