Repnotify is firing before replicated variables references are loaded

I have a fast moving platform based game, physics like jumping and moving don’t work correctly on fast moving platforms so I use the standard backroom method to create physics. This project supports 8 people that could be leaving and joining at any time.

When the player gets on the platform I store them and their attach point (just a child actor) in replicated arrays, and set a repnotify array to attach the player mesh component to the child actors root.

This works great when other players are there to see the player enter the platform, but when someone joins I get many errors about how the player and the attach point actors are invalid because the repnotify seems fires before it loads all the referenced actors that are in the replicated variables.

I came to this conclusion by looking at the error log and seeing all references inside the repnotify are what are throwing errors, and on tick printing the references and seeing the list of print statements start blank, see the repnotify function fire, then the reference list becomes valid and prints the actor references.

How can I fix this?

Repnotify cannot rely on another actor/components existence. Change your approach.

If you’re using cmc you can disable server correction while on the platform. This should fix the movement issues.

2 Likes