How to expose Unity tags in the inspector?

Thank you for that.

OK why are tags strings?!
And layers are ints (or worse strings)!

Not sure why Unity did not have some type that could be auto Inspected for these, while being optimal to compare.
I have grabbed Single Layer Inspector code before, now I need single tag inspector code (when it should be provided!)

/rant

the Cinemachine solution still exists once I worked out what to extract (not using Cinemachine), so thanks!!

Tags are for new beginners, when you get more advanced you realize markup components and similar are better tools in the toolbox

I use both - tags are super simple for quick checks. But a component can indeed give a lot more info, though not without some added weight

Tags never make sense. They are magic strings. Never use magic strings

Isn’t that what they have done again with UI Toolkit?! Please stop it with the magic strings - Unity Engine - Unity Discussions

I mean there’s my post after OP which shows a work around. We have always been able to Q<T> for strongly typed visual elements.

This is also completely off topic to the thread.

Tags are an old feature of Unity. They are no longer needed and could honestly be removed without any loss.

Today I came across this same problem, while trying to make a beginner-friendly tool. My solution was this:

  1. Property:
public sealed class TagMaskFieldAttribute : PropertyAttribute { }
[CustomPropertyDrawer(typeof(TagMaskFieldAttribute))]
    public class TagMaskFieldAttributeEditor : PropertyDrawer
    {
        public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
        {
            property.stringValue = EditorGUI.TagField(position, label, property.stringValue);
        }
  1. Implementation:
public class ScriptExample : MonoBehaviour
    {
        [SerializeField, TagMaskField] private string _tag;
    }
  1. Inspector Result: