# Multicast being called before replicating variable

**URL:** <https://forums.unrealengine.com/t/multicast-being-called-before-replicating-variable/432536>\
**Category:** Blueprint\
**Tags:** Replication, multicast, unreal-engine, bug-report, Blueprint, question\
**Created:** [August 27, 2018, 7:57am UTC](https://forums.unrealengine.com/t/multicast-being-called-before-replicating-variable/432536 "2018-08-27T07:57:35Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_4116411d](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_4116411d](https://forums.unrealengine.com/u/anonymous_user_4116411d)\
**Post date:** [August 27, 2018, 7:57am UTC](https://forums.unrealengine.com/t/multicast-being-called-before-replicating-variable/432536/1 "2018-08-27T07:57:35Z")

</div>

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

 ![251682-sin-titulo.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/9/b/59bdd1d2b176bc55ddb7b4df6f9edcc0f5872c5c.png)

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?

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_4116411d](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_4116411d](https://forums.unrealengine.com/u/anonymous_user_4116411d)\
**Post date:** [August 27, 2018, 5:34pm UTC](https://forums.unrealengine.com/t/multicast-being-called-before-replicating-variable/432536/2 "2018-08-27T17:34:31Z")

</div>

no answers?

---

<div class="post-metadata">

**Author:** ![NijoMeister](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@NijoMeister](https://forums.unrealengine.com/u/NijoMeister)\
**Post date:** [August 27, 2018, 6:19pm UTC](https://forums.unrealengine.com/t/multicast-being-called-before-replicating-variable/432536/3 "2018-08-27T18:19:07Z")

</div>

Hi, Nico\_Pucho\_27! Could you show me the Multicast function you are running?  
Thanks!

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_4116411d](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_4116411d](https://forums.unrealengine.com/u/anonymous_user_4116411d)\
**Post date:** [August 27, 2018, 6:27pm UTC](https://forums.unrealengine.com/t/multicast-being-called-before-replicating-variable/432536/4 "2018-08-27T18:27:56Z")

</div>

sure! it simply hides an array of static meshes and then only shows one of them

 ![251736-sin-titulo.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/1/d/d1deda54e018423d7d53edae40b73590766f920e.png)

the problem is that it shows the previous current mesh and not the new one

---

<div class="post-metadata">

**Author:** ![NijoMeister](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@NijoMeister](https://forums.unrealengine.com/u/NijoMeister)\
**Post date:** [August 27, 2018, 6:30pm UTC](https://forums.unrealengine.com/t/multicast-being-called-before-replicating-variable/432536/5 "2018-08-27T18:30:24Z")

</div>

Hi again, instead of getting the variable ‘Currentgun’ normally try to get it through the function,  
Hope this helps 😃

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_4116411d](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_4116411d](https://forums.unrealengine.com/u/anonymous_user_4116411d)\
**Post date:** [August 27, 2018, 6:34pm UTC](https://forums.unrealengine.com/t/multicast-being-called-before-replicating-variable/432536/6 "2018-08-27T18:34:14Z")

</div>

you mean adding the variable as an input of the function?

---

<div class="post-metadata">

**Author:** ![NijoMeister](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@NijoMeister](https://forums.unrealengine.com/u/NijoMeister)\
**Post date:** [August 27, 2018, 6:35pm UTC](https://forums.unrealengine.com/t/multicast-being-called-before-replicating-variable/432536/7 "2018-08-27T18:35:58Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![GarnerP57](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@GarnerP57](https://forums.unrealengine.com/u/GarnerP57)\
**Post date:** [August 27, 2018, 6:41pm UTC](https://forums.unrealengine.com/t/multicast-being-called-before-replicating-variable/432536/8 "2018-08-27T18:41:43Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_4116411d](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_4116411d](https://forums.unrealengine.com/u/anonymous_user_4116411d)\
**Post date:** [August 27, 2018, 6:44pm UTC](https://forums.unrealengine.com/t/multicast-being-called-before-replicating-variable/432536/9 "2018-08-27T18:44:31Z")

</div>

so multicast functions haves more priority than replicated variables?

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_4116411d](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_4116411d](https://forums.unrealengine.com/u/anonymous_user_4116411d)\
**Post date:** [August 27, 2018, 6:47pm UTC](https://forums.unrealengine.com/t/multicast-being-called-before-replicating-variable/432536/10 "2018-08-27T18:47:44Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![GarnerP57](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@GarnerP57](https://forums.unrealengine.com/u/GarnerP57)\
**Post date:** [August 27, 2018, 6:49pm UTC](https://forums.unrealengine.com/t/multicast-being-called-before-replicating-variable/432536/11 "2018-08-27T18:49:53Z")

</div>

In that case you want to use only the Multicast with the variable as a parameter and not RepNotify

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_4116411d](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_4116411d](https://forums.unrealengine.com/u/anonymous_user_4116411d)\
**Post date:** [August 27, 2018, 7:00pm UTC](https://forums.unrealengine.com/t/multicast-being-called-before-replicating-variable/432536/12 "2018-08-27T19:00:44Z")

</div>

thanks! could you take a look at this question too?

> **[Replicate static mesh rotation](https://forums.unrealengine.com/questions/821713/view.html)**
>
> i have a cube inside my character that rotates towards the mouse location with this function my player and the cube has replication enabled but currently the server is the only one replicating his rotation… with this i mean that the clients get...

---

<div class="post-metadata">

**Author:** ![mightyenigma](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@mightyenigma](https://forums.unrealengine.com/u/mightyenigma)\
**Post date:** [December 7, 2018, 1:08am UTC](https://forums.unrealengine.com/t/multicast-being-called-before-replicating-variable/432536/13 "2018-12-07T01:08:15Z")

</div>

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.
