Multiplayer - Null object reference from server to client RPC
Working on my multiplayer spell system for an RPG game.
I'm running into an issue where I create a BP_Skill object on server side (replicates and always relevant), and I need to pass this reference to the client in order to set up some HUD-related things.
However, On the client-side function, the BP_Skill object is not found. I have tested this with a struct (Skill Info), which gets passed properly to client.
Any help would be greatly appreciated!
asked Jun 01 '17 at 03:15 AM in Blueprint Scripting
This is a fun one!
I tested this by passing an array of actor references to a "run on server" event that subsequently called "owning client" event and passed that array as well. Everything worked. There is no problem with putting references into arrays and passing them around with UE4 multiplayer framework.
Your problem is different. Notice how you spawn the actor, put their reference in the array and immediately pass it to an event. Well, the problem is that you are doing it so fast that the fact of spawning the actor did not get replicated to the client yet. So your arrays contain references of actors whose NetworksGUIDs are not yet known to the client.
The reason that structs are working is that they are simple data, they get passed by value. Actors however dont have that luxury.
Try adding a delay or calling that event a bit later in another manner (once you verify all clients have your actors)
Follow this question
Once you sign in you will be able to subscribe for any updates here