How do you get the component/access the script of the object you hit?
For example, when Object A hits Object B, I want Object A to have access to the scripts of Object B.
Also, Object A and Object B are CLONES. So I can’t just use static because it would affect the other clones. I only want to modify the other object it hits, not the other objects. Also, I can’t just get the component as is, because it would get the component of a random Object B, not the Object B it hits with its collider.
Here’s an example code:
private ObjectB compo;
compo = GetComponent<ObjectB>();
void OnTriggerEnter(Collider col)
{
compo.Killed = false;
//There are many Object Bs, so this would probably get executed on a random Object B,
//instead of the Object B it hits.
}
Thanks!