Unity3d获取在Asset中选中的目录 资源 的路径

分享一下我老师大神的人工智能教程!零基础,通俗易懂!http://blog.csdn.net/jiangjunshow

也欢迎大家转载本篇文章。分享知识,造福人民,实现我们中华民族伟大复兴!

               
[MenuItem("Tools/testselect")]    public static void testselect()    {        UnityEngine.Object[] arr=Selection.GetFiltered(typeof(UnityEngine.Object), SelectionMode.TopLevel);        Debug.LogError(Application.dataPath.Substring(0,Application.dataPath.LastIndexOf('/'))+"/"+ AssetDatabase.GetAssetPath(arr[0]));    }

如果要遍历目录,修改为
SelectionMode.DeepAssets

这个方法只能对右边选中的文件生效,左边的无效


           

给我老师的人工智能教程打call!http://blog.csdn.net/jiangjunshow

这里写图片描述

你可能感兴趣的:(Unity3d获取在Asset中选中的目录 资源 的路径)