Hello, allow me to illustrate what I want to do:
Let’s say we have 1 script named script, and 2 gameObjects: object A and object B.
The script is attached to object A. The following code is inside script:
function OnCollisionEnter() {
//when something collides with object A
print("hi");
}
But what I want to do is find out when something collides with object B, not Object A.
Is there any way to have the “OnCollisionEnter()” function apply to object B without attaching the script to Object B?
EDIT:
I want to do this so that I don’t have to have multiple instances of code running at one time. For example, I would only need to have one script that controls when something collided with all the bullets (object B) in the scene, even when there are multiple bullets.