Destroying Projectiles When I Leave the Room?

Hi, I’ve been trying to solve this problem for a while. Right now whenever I shoot a ton of arrows in a room and then leave the room, the arrows are still flying about in the new room. I tried to use broadcast message but that does not work because I can’t broadcast between scripts. Your answers are greatly appreciated.
Thanks,
Imnooby o3o

The easiest way would be, during your room update, to get a list of all lingering arrows and send them a message or destroy them. Something like this:

        ArrowBehaviour[] allArrows = GameObject.FindObjectsOfType<ArrowBehaviour>();
        foreach (ArrowBehaviour arrow in allArrows)
        {
            arrow.SendMessage("Whatever");

            // or

            GameObject.Destroy(arrow.gameObject);
        }

However, once you get that working you should consider optimizing it by keeping track of the arrows yourself and replacing the Instantiate/Destroy with your own pooling mechanism.

Cheers.