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

               
[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

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


           

相关文章

前言 本文记录unity3D开发环境的搭建 unity安装 unity有中文...
前言 有时候我们希望公告牌跟随镜头旋转永远平行面向屏幕,同...
前言 经过一段时间的学习与实际开发,unity3D也勉强算是强行...
前言 在unity中我们常用的获取鼠标点击的方法有: 1、在3D场...
前言 在之前的例子中,我们都没有用到unity的精髓,例如地形...
这篇文章将为大家详细讲解有关Unity3D中如何通过Animator动画...