来自场景的实际未过滤选择。
将返回所有对象,包括项目中的资源。您还可以将对象分配给选择。
另请参阅:Selection.instanceIDs。
Scriptable Wizard that lets you select GameObjects by their tag.
using UnityEngine; using UnityEditor;
class SelectAllOfTag : ScriptableWizard { string tagName = "ExampleTag";
[MenuItem("Example/Select All of Tag...")] static void SelectAllOfTagWizard() { ScriptableWizard.DisplayWizard( "Select All of Tag...", typeof(SelectAllOfTag), "Make Selection"); }
void OnWizardCreate() { GameObject[] gos = GameObject.FindGameObjectsWithTag(tagName); Selection.objects = gos; } }