- Home /
How do I add a new tag in Unity?
Ok, so I keep getting the error: UnityException: Tag: Projectile is not defined!
void OnTriggerEnter(Collider collider){
if (collider.gameObject.CompareTag("Projectile")){
Destroy(this.gameObject);
Answer by LijuDeveloper · Nov 29, 2013 at 06:24 AM
1.Select Object
2.Go to Inspector > Tag > Add Tag >Tag
3.Set Size , Enter "TagName"
4.Click on object to add tag
5.Go to Inspector > Tag > "TagName"
Answer by highpockets · Nov 29, 2013 at 05:21 AM
To add a tag. You can do it in the editor. Select the object and right above the transform component, yOu will see tags and layers. They both have dropdown menus and you can select add new layer or edit tag or something rather. After selecting that, you will see the list of tags and layers. Add your tags there and set them from that tag dropdown menu above the transform or by code gameObject.tag = "Tag Name";
Your answer
Follow this Question
Related Questions
melee system script problem, what did i do wrong or what to do next? 0 Answers
Help with Void Boolean Text problem 1 Answer
How to add certain GameObjects with Booleans to an Array 1 Answer
Cannot implicitly convert type `UnityEngine.GameObject[]' to `UnityEngine.GameObject' 1 Answer
UnityException: Tag: - is not defined! (OnTrggerEnter) 1 Answer