Detecting collisions between instantiated prefabs?
Hi,
I am currently working on a mini game in the "create with code" course, and I am trying to get an integer value for the number of collisions that occur between two instantiated objects (pizza and chicken). The purpose is to know how many of the chicken that disappeared have disappeared due to a collision with pizza. I managed to count how many of them disappeared by adding a tag and checking their number using the player controller script, but it doesn't distinguish between those that disappear due to the bounds and those that disappear due to collision.
I tried referencing the script class responsible for detecting their collisions, but it says I need to reference a game object as well. Since the object only exists when instantiated, how could I tally their collisions once they occur?
Is there a function I could use within the player controller script that can detect collisions between objects that are tagged? Essentially I need a way to detect that isn't tied to the instantiated object itself. Thank you for reading!