|
Hello. I know how to make it so that a function happens when the object that a collision script (like the one below) is attached to collides with another object, but is there a way to make a script that references another object for both objects? For example, the script is attached to object A and it says something like "When object B enters the trigger of an object with the tag "C" object B = destroyed)? Thanks.
(comments are locked)
|
|
You've pretty much answered this question yourself: Reference object A (the script carrier) on either B or C. Make B or C detect collisions/ triggers and send a message/ call a function from A when OnTriggerEnter. If I'm not mistaken, this is one of the basics of gameController-centered game building, in which you have one central script that all other objects reference and call.
(comments are locked)
|
