Selection.objects 物体列表
static var objects : Object[]
Description描述
The actual unfiltered selection from the Scene.
来自场景中实际未过滤的选择物。
Only objects from the Scene or Hierarchy will be returned, not from the Project View. You can also assign objects to the selection.
只有在场景中或者检测面板中的物体将会被返回,在工程试图里的则不能。你也可以赋值一个对象到选择。
Scriptable Wizard that lets you select GameObjects by their tag.
ScriptableWizard,让你通过tag选择GameObject。
// C# Example
// Select objects based on their tags
//根据标签选择物体
using UnityEngine;
using UnityEditor;
public class SelectAllOfTag : ScriptableWizard {
public string tagName = "ExampleTag";
[MenuItem ("Example/Select All of Tag...")]
public static void SelectAllOfTagWizard() {
ScriptableWizard.DisplayWizard(
"Select All of Tag...",
typeof(SelectAllOfTag),
"Make Selection");
}
void OnWizardCreate() {
GameObject[] gos = GameObject.FindGameObjectsWithTag(tagName);
Selection.objects = gos;
}
}
最后修改:2011年4月11日 Monday 12:23