First I define a string:
public string floorTag;
And later I say that something with the tag “floorTag” should do something:
if (hit.transform.tag == floorTag)
The problem is that this does not work unless I define “floorTag” in the editor (the actual name of the tag I want is “Floor”). How can I define the ambiguous string floorTag as the tag, so that it doesn’t even show up in the editor?
Looking at this answer: http://answers.unity3d.com/questions/33597/is-it-possible-to-create-a-tag-programmatically.html
It does not appear possible:
“Tags must be declared in the tag manager before using them”
Maybe if you explain why you wanted floorTag to be ambiguous we could help with that? There’s nothing to stop you changing the tag in code eg.
hit.transform.tag = "Floor"; //where "Floor is defined in the editor"
If it’s something where you’d end up with too many types/alterations of floorTag maybe you should keep the simple “Floor” tag in the editor as above to narrow is down and then consider a different variable storing its’ more specific id that you can query after.