Answer the question
In order to leave comments, you need to log in
How to make it so that when an object with a specific tag touches another object (also with a specific tag), [something] happens?
Let's say if (object with tag "1") touches (object with tag "2"), then something happens, for example, a message is printed to the console.
Answer the question
In order to leave comments, you need to log in
Add Collider and Rigidbody to both objects. Create the necessary tags for both objects.
And for example, in the script of the first object, write this:
void OnCollisionEnter(collision col)
{
if(collision.gameObject.tag == "тэг второго объекта")
{
Debug.Log("первый объект столкнулся со вторым")
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question