Before anything else. PLEASE HELP ME, I HAVE TRIED EVERYTHING AND NOTHING WORKS. I AM TOO INCOMPETENT TO FIGURE IT OUT .
Now, without further ado:
Hello, I’ve been trying and failing to fix a very simple but confusing bug that has to do with RPCs. A reference in a blueprint exists on all clients, but can’t be accessed when a multicast is called.
What I am trying to do is rather simple: The character controller, upon pressing V, sends out a Server RPC to then send out a Multicast RPC to get the HUD and show/hide an icon. That’s all!
Now, since the issue is with getting the HUD variable in the multicast, I will spare you how the UI blueprint works and solely focus on the part that is failing.
First, we handle input, as you can see, pressing V calls our “SV” Server RPC function, which just calls a Multicast RPC telling each client to, in their own Character Controller (since we fetch “Player HUD” inside the Multicast RPC), to execute a function in the “Player HUD” (client-side).
Next, in our “Player HUD”, we print out “Show me VC!” if the button was pressed, and a list of players in the server if released, controlled by the boolean we passed.
So, what happens if we press “V” during tests?
If the server host presses the key:
- Prints out both “Show me VC!” and the player list
- Clients do not react whatsoever, nothing prints
If the a client presses the key:
- Noting prints
- Server host prints out “player hud does not exist”
It is a fact that the player HUD exists on all clients. I’ve tested this very thoroughly, I even have a debug function inside the player controller that prints out data from the player HUD every second after a button press. It works on all clients.
Today, I’ve worked on this bug for 11 hours straight without even stopping to eat. When I went to make this post, I realized that I was no longer capable of writing coherently (and I was unable to read text either, it stopped making sense), so I was forced to take a short break to rest before I could write this.
I have been humiliated by this bug and have become obsessed with fixing it. I won’t be sleeping well tonight knowing that such a simple error has gone unresolved.