Unity编辑器中选择特定Tag的所有物体
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Unity编辑器中选择特定Tag的所有物体相关的知识,希望对你有一定的参考价值。
using System; using System.Collections; using System.Collections.Generic; using UnityEditor; using UnityEngine; using Object = UnityEngine.Object; public class FindGosByTag : ScriptableWizard { //public string m_tagName; public string[] m_tags; private int m_tagIndex = 0; void OnEnable() { m_tags = UnityEditorInternal.InternalEditorUtility.tags; } [MenuItem("Custom/Find GameObjects By Tag")] private static void CreateWizard() { ScriptableWizard.DisplayWizard("Find GameObjects By Tag", typeof(FindGosByTag), "Find"); } private void OnWizardCreate() { Selection.objects = GameObject.FindGameObjectsWithTag(m_tags[m_tagIndex]); foreach (Object Go in Selection.objects) { Debug.Log("<color=green>想得到我的Tag吗?想要的话可以全部给你 去找吧 我把所有的Tag都放在这里 </color>" + Go.name, Go); } } protected override bool DrawWizardGUI() { GUILayout.Label("Tag", EditorStyles.boldLabel); m_tagIndex = EditorGUILayout.Popup(m_tagIndex, m_tags); return true; } }
以上是关于Unity编辑器中选择特定Tag的所有物体的主要内容,如果未能解决你的问题,请参考以下文章