I’m trying to add bits to this tutorial Lesson 2.4 - Collision Decisions - Unity Learn I want to do it so on the throwing food to the animals instead of using 1 type of food for all the animals. I want to do it so the player has to feed a certain food to certain animals.
So I have a chick which I want to have to feed the sandwich to0
a dog that needs feeding steak and a stag which needs to be fed a pear. Can someone tell me how I can code this please? I’ve tried putting tags on the food and animals and using this script but it doesn’t work.
private void OnCollisionEnter(Collision collision)
{
if (collision.gameObject.CompareTag("Pear") && collision.gameObject.CompareTag("Stag"))
{
Destroy(gameObject);
}
}