Hello, I need just a couple lines (an example) that will do something if gameobject collides with other gameobject that has a tag “TAG1” and do something else if it has a tag “TAG2”. I have tried but it doesn’t do anything:
function OnCollisionEnter(coll : Collision)
{
if(coll.gameObject.tag == "TAG1")
{
type = 1;
audio.PlayOneShot(audio1);
}
}
This one doesn’t work for me as well:
function OnCollisionEnter(col : Collision)
{
if(col.gameObject.name == "clear_gold")
{
type = 8;
audio.PlayOneShot(audio1);
}
}