- Home /
Getting the Tag Array
Anyone know how to get it? I need to access it during editor mode in order to make an editor window that shows them.
Answer by yoyo · Apr 12, 2011 at 04:09 PM
EditorGUI.TagField gives you a selector for choosing a tag.
What you really want though, is UnityEditorInternal.InternalEditorUtility.tags
, which is a string array of all tags in the system. This is a public but undocumented internal feature, so it may break in future releases of Unity.
Answer by dsh · Mar 10, 2013 at 05:21 PM
string to_search_tag="Player";
for (int i = 0; i < UnityEditorInternal.InternalEditorUtility.tags.Length; i++) {
if (UnityEditorInternal.InternalEditorUtility.tags[i].Contains(to_search_tag)) {
Debug.Log ("At Position " + i + " is the Tag " + to_search_tag + " found :) ");
break;// attention : the first index is 0 !!!
}else{
}
}
Your answer
Follow this Question
Related Questions
Can a GameObject inside of an array be made "accessible" from the editor? 2 Answers
"add selected" editor script 1 Answer
Storing tag strings in an array, from an already existing array of gameobjects with different tags. 1 Answer
Extend Unity ObjectField / Array function/Gui interface 1 Answer
Custom editor tags not saving 1 Answer