Selection.GetFiltered
来源:互联网 发布:json数组遍历 java 编辑:程序博客网 时间:2024/05/20 02:55
Selection
Selection是编辑器类,需要放在在Assets/Editor目录下。
SelectionMode
(摘自:https://docs.unity3d.com/412/Documentation/ScriptReference/SelectionMode.html)
[MenuItem("Assets/SelectionMode/SelectionMode.Unfiltered")] public static void SelectUnfiltered() { UnityEngine.Object[] arr = Selection.GetFiltered(typeof(UnityEngine.Object), SelectionMode.Unfiltered); for (int index = 0; index < arr.Length; index++) { string filePath = AssetDatabase.GetAssetPath(arr[index]); Debug.Log("filePath=" + filePath); } }
对该目录做操作:
- SelectionMode.Unfiltered
执行后打印:
获得整个选中的对象的路径。但是不遍历。
当选中多个物体(文件夹或者预制件)的时候,打印如下:
- SelectionMode.TopLevel
当选中一个:跟SelectionMode.Unfiltered结果一致
当一次选中多个:跟SelectionMode.Unfiltered结果一致 - SelectionMode.Deep
-能返回所有包括文件夹和预制件的集合 - SelectionMode.ExcludePrefab
选中文件夹和预制件
打印结果是:
忽略了预制件项! - SelectionMode.Editable
This will filter generated prefabs from an imported fbx file but not user created prefabs. - SelectionMode.Assets
- SelectionMode.DeepAssets
收集所有包括文件夹,Assets,子文件夹。
Selection.GetFiltered
static function GetFiltered (type : Type, mode : SelectionMode) : Object[]
if type is a subclass of Component or GameObject the full SelectionMode is supported.
if type does not subclass from Component or GameObject (eg. Mesh or ScriptableObject) only SelectionMode.ExcludePrefab and SelectionMode.Editable are supported.
如果Type是Component或者GameObject的子类,全部selectionMode都可以支持;
否则SelectionMode.ExcludePrefab and SelectionMode.Editable 类型才支持;
默认是:SelectionMode.TopLevel | SelectionMode.ExcludePrefab | SelectionMode.Editable.
- Selection.GetFiltered
- Selection
- Selection
- :: selection
- Selection sort
- type selection
- Selection Sort
- 7、Selection
- Selection sort
- feture selection
- model selection
- Selection Sort
- Selection Screen
- selection sort
- document.selection
- range-----selection
- CSS ::Selection
- random selection
- Android Studio获取开发版SHA1和发布版SHA1以及MD5
- masterJ2SE篇003——使用脚本启动java程序
- SIGTERM SIGINT
- 如何清除statspack相关表的历史数据
- javascript入门基础篇重点 第六节
- Selection.GetFiltered
- js实现表单验证(submit /button)
- C# 泛型
- Block的一些实用性理解
- 免密启动hadoop服务
- Docker image 存储路径 解析
- 30个酷毙的交互式网站(HTML5+CSS3)
- Gradle Error: SSL peer shut down incorrectly
- Newtonsoft.Json的高级用法