Download

Notification/event when PlayerState has finished replicating after a seamless travel?

Hello!

I’m using a PlayerState object with some custom replicated variables and overriden copyproperties to persist some data, like player color, between levels after a seamless travel.

My issues it that if I try to read the variables in the BeginPlay event of the players pawn, they are not yet replicated to clients, so they only read null/default values from it. I tried reading the variables on every tick, which does read the proper custom variable value, but I’m not happy about having to read the color variable and set it on the pawns mesh every tick. It’s an unnecessary overhead, because the variables never change during the map, so once they’ve been successfully read once they never have to be read again.

Does anyone know of a way to avoid doing it every tick, but still reliably do it only once after the values have been properly replicated? I’d like to avoid using a delay node in the BeginPlay event too, because there’s no way to find an amount of time that’s sufficiently low yet still reliable long enough to ensure the variables have been replicated.

I fixed it myself.

I added a 0.1s retriggerable delay at the end of BeginPlay that keeps being triggered until PlayerState is valid.