赞
踩
复制的路径会保存到操作系统的剪贴板中,使用Ctrl + V 即可粘贴。
using UnityEditor;
using UnityEngine;
namespace ZYF
{
public class ProjectCopyPath : MonoBehaviour {
[MenuItem("Assets/复制绝对路径", priority = 19)]
static void CopyTransPath()
{
string path = "";
if (Selection.assetGUIDs != null && Selection.assetGUIDs.Length == 1)
{
path = AssetDatabase.GUIDToAssetPath(Selection.assetGUIDs[0]);
}
//去除开头
string pAssets = Application.streamingAssetsPath.Replace("StreamingAssets", "");
pAssets = pAssets.Replace("/Assets","");
string fPath = pAssets + path;
GUIUtility.systemCopyBuffer = fPath;
Debug.Log("<color=#ff00ff><size=25>已复制绝对路径:</size></color>"+fPath);
}
}
}
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。