x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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!

alt text alt text alt text

Product Version: UE 4.15
Tags:
more ▼

asked Jun 01 '17 at 03:15 AM in Blueprint Scripting

avatar image

fishbone94
44 5 6 9

(comments are locked)
10|2000 characters needed characters left

1 answer: sort voted first

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)

Good luck

more ▼

answered Jun 05 '17 at 11:58 AM

avatar image

Irakli
443 15 6 24

avatar image fishbone94 Jun 06 '17 at 12:57 AM

You're an absolute life saver. I couldn't figure it out for days because I didn't expect there to be a spawn/delay issue.

Everything works as intended now after fitting in a 0.5s delay before passing the array of actors! Cheers!

avatar image Irakli Jun 06 '17 at 08:52 AM

Glad to help. Good luck with your project.

avatar image chiefGui Feb 21 '18 at 03:02 AM

Hey dudes!

Sorry for resurrecting this thread but... isn't setting a manual delay... error prone? I mean, you can't guarantee that the variable will be replicated in time to the client, regardless of the amount you put.

avatar image Exonfluxx Feb 21 '18 at 04:19 AM

Hey dudes!

Sorry for resurrecting this thread but... isn't setting a manual delay... error prone? I mean, you can't guarantee that the variable will be replicated in time to the client, regardless of the amount you put.

yes. but in some cases if your delay is just small enough you can but your risking a lot on perfect ping. there are other ways around this. The problem is the method being used.

avatar image Irakli Feb 21 '18 at 09:21 AM

Yes it is, which is why I also suggested the second way to handle it (verify all clients have your actors before executing an action that requires said actors). Can be done through either having a loop running with delay on client side checking the required actors for null and finally executing the follow-up action when it is not null, OR if the action HAS to be executed by server then server getting a callback from clients confirming creation of actors, and subsequent server initiated action.

avatar image chiefGui Feb 21 '18 at 02:18 PM

Or maybe RepNotify? That's what I'm using--pretty consistent. Just to sum up with your answers.

avatar image FinalZer0 Dec 06 '18 at 08:24 AM

I had error even with repnotify, i ran out of options and redesign my code. It somehow worked

(comments are locked)
10|2000 characters needed characters left
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question