If an object (ex. cube) has OnCollisionEnter on it, should the following code work correctly if the object hits any other object?
function OnCollisionEnter(shotCollide : Collision)
{
Debug.Log(“hit”);
}
or do I have to write this:
function OnCollisionEnter(shotCollide : Collision)
{
if (shotCollide.gameObject.name == (“anyObject”))
{
Debug.Log(“hit”);
}
}