- Home /
Changed Prefab tag Still objects untagged??
I created prefab and tagged it with "Player" .But the clone objects they still untagged
i even printed
void OnCollisionEnter2D(Collision2D collInfo){
Debug.Log (collInfo.collider.tag); //Prints untagged
if(collInfo.collider.tag=="Player")
Debug.Log("CAlled");
}
I cant understand why this is happening ? I changed the prefab tag ,still its clones are untagged
Answer by YOYO999 · Apr 29, 2014 at 08:27 AM
I also find this problem. And my code is similar to yours . Finally , I find the solution is also add collider component in "Player" object(Two object both have collider component), then debug.log(collider.tag) will print "Player".
Answer by · Jun 19, 2016 at 05:05 AM
Answer by haim96 · Mar 09, 2014 at 02:30 PM
if you dragged the prefab to the scene and then changed the tag you need to press apply button. so the change will be applied to the original prefab.
Answer by Erenes · Apr 07, 2017 at 09:25 AM
To anyone else who has this problem, the mistake I made was applying the tag to the folder under the hierarchy view instead of the actual prefab under the project view.
Your answer
![](https://koobas.hobune.stream/wayback/20220613135806im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Use trigger with player but have a collider with everything else? 3 Answers
What's wrong with OnCollisionEnter? 2 Answers
CompareTag being ignored? 1 Answer
handling collision with two objects of the same tag 1 Answer
Collision Layer 2 Answers