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?
Hi, Nico_Pucho_27!
That is exactly what I mean!
If that doesn’t work then there might be a problem with setting the variable, however that is very unlikely.
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.
and what if a variable is = 0 and i set it again = 0? the engine is not notifying the players because the variable didn’t change, but i still want to execute the code inside the On Notify function
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.