I am using this function to syncronize camera rotation with the rotation of the character when it spawns (not on player start, just spawns somewhere and is possessed after that).
The problem is that wherever I place this function, in BeginPlay, or in ReceiveControllerChanged, it doesn’t work instantly, it works 50% cases (with simulated average ping) with 0.2 delay and it works about 100% cases with 1 second delay, but it’s not acceptable for me to wait this time. It doesn’t work along with printing the correct message, so it’s not the problem that controller is invalid, I guess, but rather some built-in **** overrides my camera rotation after my event execution without delay.
Actually we always start with the camera with the default zero rotation, which gives a clue that it’s somewhere in the constructor. After digging into Lyra code, I found that there are a couple rotators in the camera modes, which possibly go into control rotation syncing of Lyra camera.
Then I remembersed that camera mode initialization happens when the pawn is ready, which is defined in the pawn extension component and relies on many events, like receive controller changed, onrep_pawndata, etc, this could explain the instability of delays in the post above.
In the end, I decided to do sync one frame after pawn becomes ready, which should be just after camera mode is first initialized and after it receives some zero rotation (seems it’s what spoiled my previous attempts).