Question by
orenko · Sep 15, 2016 at 11:37 AM ·
editor-scriptingprefabsscriptingbasicstagstagging
Can't tag prefab with a string
Hi, I'm trying to add a simple string tag to my prefabs: if file name suffix is "_NC", i want to add the tag "Choose". I looked online and so that all I have to do is prefab.tag, So I wrote the following code: if (fileName.Substring(snackName.Length - 3).Equals("_NC")) prefab.tag = "Choose";
But I get the error: UnityException: Tag: Choose is not defined.
How can I fix it? I saw in some places that perhaps tags can be created only by editor. If it is indeed the case, how do I create a tag and use it in the code, when I am creating some new prefabs?
Thanks
Comment
Best Answer
Answer by NerdClown · Sep 15, 2016 at 11:57 AM
Edit -> Project Settings -> Tags and Layers.
I believe that's what you're looking for!
Your answer
![](https://koobas.hobune.stream/wayback/20220612092842im_/https://answers.unity.com/themes/thub/images/avi.jpg)