Broadcast Message not being received.

I am trying to send a BroadcastMessage message to another GameObject.

    if (currentHealth <= 0 && Dead == false)
    {
        BroadcastMessage("PlayerOneDead");
        Debug.Log("Message Sent");
        Dead = true;
        currentHealth = 200;
        gameObject.SetActive(false);
    }

Above is the script for the dying character. Below is the script for the Game Manager.

public void PlayerOneDead()
{
    Debug.Log("MessageRecieved");
    StartCoroutine(McCreeRespawn());
}

IEnumerator McCreeRespawn()
{
    yield return new WaitForSeconds(4);
    BroadcastMessage("McCreeRespawn");
    PlayerOne.SetActive(true);
}

The dying part works. The player is disabled, and the message is sent, since I receive the Debug.Log. The message is, however, not being received by the Game Manager object, because I am not getting “MessageReceived” in the Debug menu. I was told that it had to do with disabling the Player GameObject before it can send a message, but that is not the problem, since I receive the Debug, which is later in the script. I am at a complete loss at what I am supposed to do to fix it, as I have used BroadastMessage before, and it works then, but not now. Is there anything I can do to fix this, or should I just set the Player to invisible, instead of disabling it entirely? Any help is appreciated.

Never mind, after lots of trial and error, I fixed it myself by making the GameManager a GameObject in the player script, and using SendMessage to send the message directly to the GameManager, instead of relying on BroadCastMessage.

Thank you guys so much for your help :slight_smile: