Replace Delay with Event

I am setting the player name’s within my Character blueprint which inherits from a custom Character c++ class.

As you can see I am using a Delay node. However, the time it takes for Player State to have the Player Name is not consistent.

So, I was thinking about tying to an Event and using that instead of the Delay.

I searched and found a couple candidates.
APawn::OnRep_PlayerState or

However, neither of these are exposed to BP.

Is there an event I could use that is already exposed? If not which of these would be better to use for this?


There aren’t, no. That I know of, anyway. If you’re already using a custom c++ class, why not also create a custom Player State class override OnRep_PlayerName and use it to trigger a BlueprintImplementableEvent on your character?

I did it with OnRep_PlayerState instead since I needed to access it within the Character BP. However, it only works for clients. It never gets hit for the server.

While blueprint replication events are triggered in bp automatically on the server, you need to manually trigger them yourself on the server if they are defined in c++. Add yourself a SetName (or override the one that’s there) on the server and call it manually after changing the name:

virtual void SetName( FString Name ) override /* possibly */
  PlayerName = Name;

I ended up using OnRep_PlayerState for the client. And PossessedBy for the server.