So I’ve been pulling out my hairs one by one trying figure this one out. It’s probably quite an obvious mistake, but I can’t seem to find it. I’m trying to send a message to all enemies in the scene from the player when the player dies.
Here are the parts of the player script:
public GameObject[] enemies;
void Awake()
{
enemies = GameObject.FindGameObjectsWithTag("Enemy");
}
void Respawn()
{
for (int i=0; i<enemies.Length; i++)
{
enemies*.SendMessage("PlayerDied");*
- }*
}
And the enemy script just has a function called “PlayerDied”, which sets the enemy in a passive state. The problem is, I keep getting the error that says: ‘SendMessage has no receiver!’
Any help would be appreciated!