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"

NetMulticast function client NULL

Hi.

I have two clients and a dedicated server.

When a client press a button he does a bunch of actions and then calls a server function

 UFunction(Server, Reliable, WithValidation)
 void ServerSwap();

And this server function just calls a netMulticast function

 UFunction(NetMulticast)
 void AllSwap();
 
 void ServerSwap_Implementation()
 {
    AllSwap();
 }


Then the NetMulticast function checks if it's a client, because I don't want the server to do anything and if it is he just assigns something to a variable.

 void AllSwap_Implementation()
 {
    if(Role < Role_Authority)
    {
       float Temp = FloatArray[0];
    }
 }

So putting a breakpoint there, I see that the server tries to go in but he can't because of the role check, and then both clients go in. everything should be alright. the problem is that the first client that goes in has for some reason everything not initialized (NULL).

FloatArray is an array of floats that I have and I initialize this on the PostBeginPlay. Im sure that by the point I press the button this has been initialized because it has been used before. and isn't just this "FloatArray". everything for that client that I try to call from this particular function is set to NULL. The second client has everything fine though.

I'm not sure what's going on here! anybody can add some light to it?

Note1: All the functions are created and called in my own playerController Note2: I wrote the code just know for this post so if for some reason there is a sintax mistake it's because I just tried to explain myself as much as I could and I dont have the source code with me at the moment.

Product Version: UE 4.8
Tags:
more ▼

asked Jul 15 '15 at 09:27 AM in C++ Programming

avatar image

Grendert
13 5 15 13

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

0 answers: sort voted first
Be the first one to answer this question
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