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"

Calling C++ NetMulticast from Blueprint is bugged

A parameterized NetMulticast function in C++ that is also BlueprintCallable seems to only properly pass the parameter values to one client while the other clients just receive 0 values.

Example:

  • We have 3 clients connected to a dedicated server.

  • MyGameStateC is a C++ class with a NetMulticast function called BroadcastByte(uint8 InByte).

  • BroadcastByte is a UFUNCTION(BlueprintCallable, BlueprintAuthorityOnly, Category = "MyGame").

  • MyControllerBP is a PlayerController with a To-Server RPC called BroadcastMyByte.

  • A player calls this event and BroadcastMyByte successfully receives the byte (let's say 0x3).

  • Now on the server, BroadcastMyByte calls the C++ BroadcastByte on a MyGameStateC object.

  • Client 1's BroadcastByte receives 0x3. Client 2's BroadcastByte receives 0x0. Client 3's BroadcastByte receives 0x0.

  • So why didn't Clients 2 and 3 receive 0x3?

Client 1 is not a listen server. He's just the only client that happened to receive the correct byte. I stepped through UE4 in debug and it would appear that a BlueprintCallable NetMulticast takes a special route instead of the C++ route. This route apparently does not properly package the byte to be sent to all clients after it sends it prepares it for the first client. Upon discovering this, I simply added another BlueprintCallable C++ function that would call my NetMulticast function, and that fixed the issue. All clients then received the correct byte. This is a workaround though, and not a solution.

Product Version: Not Selected
Tags:
more ▼

asked Nov 05 '14 at 05:50 PM in Bug Reports

avatar image

Cobryis
472 33 18 47

avatar image Ryan Gerleve STAFF Apr 09 '15 at 11:26 PM

Hi Cobryis,

I've attempted to recreate this issue, but haven't been able to reproduce it. Does it still occur in 4.7.5? If so, a small sample project demonstrating the issue would be very helpful.

avatar image Cobryis Apr 10 '15 at 12:10 AM

Setting the UFUNCTION to BlueprintAuthorityOnly results in it only being broadcasted to the server from the server, so removing that allows for a more accurate reproduction. The issue does still exist. I just tested it. Only 1 client got the byte 0x3 and the rest got 0x0.

avatar image Cobryis Apr 10 '15 at 12:14 AM
 // Header
 UFUNCTION(BlueprintCallable, Reliable, NetMulticast, Category = UBGameState)
 void BroadcastByte(uint8 InByte);
 
 // CPP
 void AUBGameState::BroadcastByte_Implementation(uint8 InByte)
 {
     UE_LOG(LogTemp, Warning, TEXT("Client recieved: %d"), InByte);
 }
 

alt text

Output:

 [2015.04.10-00.14.47:650][201]LogTemp:Warning: Client recieved: 3
 [2015.04.10-00.14.47:652][201]LogTemp:Warning: Client recieved: 3
 [2015.04.10-00.14.47:653][201]LogTemp:Warning: Client recieved: 0
 [2015.04.10-00.14.47:655][201]LogTemp:Warning: Client recieved: 0

The first Log is the server, the second is the 1 client to receive, and the other 2 0s are the clients receiving 0 when they should be receiving 3.

avatar image Ryan Gerleve STAFF Apr 13 '15 at 11:45 PM

Thanks for the extra information, I was able to reproduce this and we're working on a fix. There is a bug with how we are processing parameters for a native multicast function when it's called from Blueprints.

avatar image Ryan Gerleve STAFF Apr 17 '15 at 09:53 PM

This has now been fixed, and will make it into 4.8. Thanks again for the report!

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

1 answer: sort voted first

Thanks for reporting this issue. We're now tracking this bug internally and will look at fixing it in a future release.

more ▼

answered Nov 07 '14 at 09:21 PM

avatar image

Ryan Gerleve STAFF
1.1k 25 12 49

avatar image Ben Halliday STAFF Nov 07 '14 at 10:56 PM

Reported in UE-5191.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
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