PlayerState reference replicates too late

I have a property in my PlayerState that I need to listen to on multiplayer client.

To do that, PlayerState calls a delegate on client. I bind to that delegate from my Character.

I tried an RPC call OnPossessed. When OnPossessed is called on server, PlayerState field is set. But by the time the client gets an RPC call , the Character on client has PlayerState == None. So I don’t have a chance to bind to the delegate, and can’t listen to that property.

I debugged it and PlayerState on client arrives later. I can delay by 0.1 seconds and then bind, and then it works. But I’d like to know, what’s the initialization event I can hook in Character blueprint, in order to get a valid PlayerState reference, guaranteed?

Well, I found a solution. It’s not a Blueprint-only solution, but it works. Maybe someone will be interested, so posting it here.

APawn has OnRep_PlayerState which is called when PlayerState is changed. It’s virtual, and you can override it in your character and call a blueprint-overrideable event.