Multicast being called before replicating variable
so i just found a very simple problem with replication and multicast... when setting a replicated variable and calling a reliable multicast after it, the multicast gets called on clients but it isn't using the new replicated value, like if the multicast got called first even tho i called the set node first
To fix this i had to add a delay between setting and multi-casting, but it isn't a fancy solution and i don't like it. Another way to fix this is to uncheck the RELIABLE box from the multicast but i also don't like that
i tried calling the multicast first and then the set node but when i do this unreal crashes instantly, i tried it 2 times already.
am i doing something wrong? or is this a bug and should i open a ticket?
asked Aug 27 '18 at 07:57 AM in Blueprint Scripting
Hi again, instead of getting the variable 'Currentgun' normally try to get it through the function, Hope this helps :D
answered Aug 27 '18 at 06:30 PM
RepNotify is what you are looking for when you want something to happen when the variable is changed. The caller is not responsible for when it arrives so just because you call it in order doesn't guarantee it arrives in that order. It is not a bug it is just how networking works.
Pass the CurrentGun through the multicast event as a parameter, set it on the handler side and then use it normally as you have it. That will sync the variable to be the same as what you set it to before calling the multicast at the moment the multicast is received.
answered Dec 07 '18 at 01:08 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here