When object A hits object B I want to communicate this to a different script.
I have a script on one object that can identify being hit by another object with a bullet tag on it and a script that does damage that work individually but I don’t know how to communicate between them.
This feels like it should be something fairly simple or maybe its easier just to do it on one script?
public class Power : MonoBehaviour
{
public GameObject DoorE;
void OnCollisionEnter(Collision collision)
{
if (collision.gameObject.tag == “Bullet”)
{
{
print(“DoDamagePls”);
}
}
}
}
//relevant part of other script
void Update()
{
if (Input.GetMouseButtonDown(1))
{
print(“DoingDamage”);
TakeDamage(20);