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; } }
时间: 2024-10-11 10:36:24