How to fetch the object which the object collides with? Unity -- collision
How to fetch the object which the object collides with? Unity -- collision
[Ans]
collision.gameObject.name;
public void OnCollisionEnter(Collision collision)
{
Debug.Log("collision name:" + collision.gameObject.name);
}
Step1:
make a collision event
with the step in the following link
(my article)
Step2:
In Script,
write the line
Debug.Log("collision name:" + collision.gameObject.name);
Comments
Post a Comment