- Home /
Tag mask dropdown like Layer mask
Is it possible to create a tag mask dropdown similar to the layer mask dropdown in a custom inspector, to be able to select multiple Tags?
EDIT: the tags are not known in advance.
Answer by GameVortex · Dec 23, 2014 at 11:27 AM
Sure. Just use the EnumMaskField, with a custom enum of your choice.
Make sure the enum uses correct values for the bitmask:
Example:
private enum MyEnum
{
MyValue1 = 2,
MyValue2 = 4,
MyValue3 = 8,
MyValue4 = 16,
MyValue5 = 32,
}
Thank you GameVortex, but how can I create the Enum dynamically if I don't know the Tags in advance? PS: I've updated my question to specify this.
Then you can use the $$anonymous$$askField ins$$anonymous$$d and edit the string array to contain the Tags you want.
Thanks! That's what I was looking for!
PS: although undocumented, UnityEditorInternal.InternalEditorUtility.tags handy returns a string array with all Tags
If you update your answer with $$anonymous$$askField suggestion, I'll be glad to mark it as the right one!
@GameVortex can you show how to do it. I mean update the answer and show all the process. I am really new and I want to learn how to do it but the only reference is this post and I really very new for understand your answer. Please if you can provide an answer with all the code required for create a Tag$$anonymous$$ask I will appreciate a lot.
PS: the link about Enum$$anonymous$$askField doesn't show the code in c# :(
Your answer
Follow this Question
Related Questions
How do I check in user-defined tags using subversion? 1 Answer
Swapping a tag for string not working, replacing a tag with a public string, help. 1 Answer
Accessing all GameObjects with a certain tag 1 Answer
How to find one object in specific layer? 1 Answer
How to detect if a specific layer is active in the camera's culling mask 0 Answers