Quantcast
Channel: Questions in topic: "tagging"
Viewing all articles
Browse latest Browse all 120

Can't tag prefab with a string

$
0
0
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

Viewing all articles
Browse latest Browse all 120

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>