Can I rename a game object’s tag with scripting?
I would like to rename the “Ball” tag to something else after the trigger.
function OnTriggerExit (col : Collider)
{
if (col.gameObject.CompareTag("Ball")
{
score.AddToScore();
}
}
Eric5h5
2
col.gameObject.tag = "SomethingElse";
–Eric
There is an error that said “SomethingElse is not defined!”
Eric5h5
4
You want to make sure you already have a tag defined with whatever name you’re calling it in the script.
–Eric
thanks eric, every thing works