Download

Confusing issue with casting (networking)

I’ll try to explain this as best as I can:

I have blueprint with two overlap boxes on both sides of the mesh. When these overlap, I have them print their names.

So, if I spawn one, and then spawn another right next to it, I would expect BOTH to print: Left, Right.

And they do, as long as in my Cast to Player (which I need because when they overlap I need to set some variables in the Player BP), I reference “Get Player Pawn”. However, when implementing networking, this won’t work as Get Player Pawn would be different for each client. For example, If I use Get Player Pawn [0], then it will only work for client 0.

So, I decided to set the “owner” of the spawned mesh to the Player who spawned it. So, pressing “1” spawns the Mesh, as well as sets the Player as the owner:

Here is the code that does this in the Player BP:
ced5518d357dc15767a6c70203538162b003ab4f.png

Here is the function that sets the player in the ‘overlap’ BP:
xoIgL2j.png

Here is the code that prints the string, both in the ‘overlap’ BP:
19afa6cfd5fac1bec7651b542a7fca41af5138f2.png

Now, like I said, if I set the casting reference to “Get Player Pawn” (shown in the last pic), it works fine. Both the first placed BP and the second one fire the overlap event. However, if I set it to the player set in the Player BP, only the currently owned BP fires the overlap event.

If anyone has any idea what is causing this or how to fix it, please let me know! Been on this issue for ages. I must be setting the “Player Owner” incorrectly but nothing I’ve tried works.

I can provide a video showing exactly what I mean if what I wrote didn’t make sense.