I have OnRep_MatchState in my gamestate, which calls a delegate.
I have multiple actors that bind to this delegate when they spawn in. How do i ensure that all my actors receive the broadcast, since some might not be spawned in at the time of the broadcast?
You could try to use the length of GameState PlayerArray or GameMode GetNumPlayers function to check, if enough players are active before firing the broadcast.
Just an idea maybe worth to try.
I appreciate the answer, but the number of players isnt what im trying to ensure, im trying to ensure that all bound actors, some of which might not be spawned in yet, receive the broadcast.
Hmm, maybe I’m getting you completely wrong, but if an actor is not yet spawned - how should he be able to subscribe to the broadcast?
The broadcast is fired, and only those, who are already subscribed (means they must exist already) can receive this one.
While any actor joining at a later time can subscribe for new broadcasts fired, but broadcasts from the past cannot be received.
So you can only check for some expected number of actors and wait, until they are all present. Or you fire the broadcast over and over, until the last one is joined - but in that case, the same question comes up: when to end firing broadcasts - in any case, you need to know, when the last actor joined, which requires to know, how many of them you expect to appear.
Not sure what you want to achieve, but maybe you can just set some flag for example in gamestate?/gamemode? - newly spawned actors can read this and perform some activity based on that information.
The bool idea is what ill go with. Sounds like itll work out to see if the broadcast has already been sent when we spawn. Thank you!
Players who just joined the server can ask if they missed the rep notify if yes get the data now, if not bind so you can get the data when it’s available.