Reputation: 25
Can't detect when I go to the object on the ground. I am sharing information about this situation below.
itemCollector.class
{
if (other.transform.tag == "Collectable")
{
print("Cmon");
Debug.Log("Come here");
}
}
Doesn't write anything in console section
Upvotes: 0
Views: 48
Reputation: 133
void OnTriggerEnter(Collision other)
{
if(other.CompareTag("Collectable")
{
Debug.Log("Come Here");
}
}
Try this instead and add the "Collectable" Tag to the object.
Upvotes: 1
Reputation: 28
I think your bottles need a rigidbody component.
Unity has a docs about it: https://docs.unity3d.com/Manual/CollidersOverview.html
Upvotes: 0