# Comunication between Scripts, possible bug

**URL:** <https://forums.unrealengine.com/t/comunication-between-scripts-possible-bug/1123847>\
**Category:** Verse\
**Tags:** unreal-editor-for-fortnite, fortnite-creative, question, fortnite\
**Created:** [April 19, 2023, 2:08am UTC](https://forums.unrealengine.com/t/comunication-between-scripts-possible-bug/1123847 "2023-04-19T02:08:38Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![K-MUS](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@K-MUS](https://forums.unrealengine.com/u/K-MUS)\
**Post date:** [April 19, 2023, 2:08am UTC](https://forums.unrealengine.com/t/comunication-between-scripts-possible-bug/1123847/1 "2023-04-19T02:08:38Z")

</div>

I wanted to comunicate between Script and use data from one script to other. I found that a possible way is to add as @editable the class of the device that you want to use in other script.

But sometimes this doesn’t work. I think I found a way to reproduce the error. I have this 2 scripts

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/b/f/2bf524b72b0d799c2d7dd8e611af0ec403cf54d1.png)

if I use “Push Changes” it works fine, if I leave the game and go to the code, without changing nothing relevant just add a space, save and then push only “Push verse code” then it doesn’t work.

Success

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/c/9/fc973ec86566d081bd0480dcaab49b5602f9fef0.jpeg)

Fails

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/8/f/08f31275b93697e7e15d9a7d94f03257e7e6e045.jpeg)

The 1st one is working fine, but on the 2nd is incorrect is showing me the initial values instead of the changed values. I have no idea why launching the game without using “push changes” generate this error, “push changes” should be used only when something is change on the editor and not only in verse.

Is there some other way to used variables that are in other script or have like a global context ?

---

<div class="post-metadata">

**Author:** ![CosmicDanAU](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/cosmicdanau/32/642728_2.png) [@CosmicDanAU](https://forums.unrealengine.com/u/CosmicDanAU)\
**Post date:** [April 20, 2023, 4:27am UTC](https://forums.unrealengine.com/t/comunication-between-scripts-possible-bug/1123847/2 "2023-04-20T04:27:39Z")

</div>

I’ve found this too, and it’s really annoying. It works the first time you Push all changes, but if you only build Verse and push that, then yeah - what you saw happens. **The editable properties on the referenced device become unassigned, and will only re-assign if you do a Full Sync every time.**

I have not found an elegant solution to this, except to avoid it completely and “fire my own events”. By “own events”, I mean simply reversing the responsibility: I have the referenced device (secondary script) call the first script in OnBegin, “registering” itself. In other words, I make the child call the parent rather than having the parent directly access the child.

This is naturally painful and ugly, especially when you have a lot of “children” devices… and also not great on memory, obviously, because everything that needs to be passed over is stored twice. But oh well.

But yeah, it’s gotta be a bug. The fact that it works fine on a fresh sync, but then breaks on a Verse push with literally no change (e.g. add an empty line), then works again on a fresh sync (again with no change), is clearly not right. I initially thought I got myself stuck in a race condition or an async visibility issue, but after extensive debugging (like what you’ve done, except even more haha) it seems to be a case of UEFN not fully propagating the assigned editables when a Verse Push is made.

---

<div class="post-metadata">

**Author:** ![DustinREDGames](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/dustinredgames/32/634988_2.png) [@DustinREDGames](https://forums.unrealengine.com/u/DustinREDGames)\
**Post date:** [April 20, 2023, 2:34pm UTC](https://forums.unrealengine.com/t/comunication-between-scripts-possible-bug/1123847/3 "2023-04-20T14:34:04Z")

</div>

This might still be a known issue they’re actively trying to fix. They said it was fixed in an upcoming build, but it still seems to have some bugs.

The current work around is to use an array rather than a single property reference to your custom device. Or use tags as a way to get references to your other custom devices. Then direct public method calls between them should work while maintaining instance property values.

Ideally I would like to see them add Verse support for public event listenables, then we wouldn’t need to make direct calls between custom devices.

> [@Blocker - Custom device's local variables are reset when called from another device.](https://forums.unrealengine.com/t/blocker-custom-devices-local-variables-are-reset-when-called-from-another-device/766865):
>
> Device1 changes a local variable in OnBegin or anytime. From a trigger callback, Device2 calls a method on Device1. In the Device1’s method, the local variable is now reset to default values. Can a custom device not reference another custom device? Its almost as if Device2 has a completely different instance reference of Device1. Is this not the proper way to do something like this? This seems like a major bug when trying to communicate between custom devices and is currently a major blocke…

---

<div class="post-metadata">

**Author:** ![K-MUS](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@K-MUS](https://forums.unrealengine.com/u/K-MUS)\
**Post date:** [April 21, 2023, 3:49am UTC](https://forums.unrealengine.com/t/comunication-between-scripts-possible-bug/1123847/4 "2023-04-21T03:49:12Z")

</div>

Thanks, for the workaround I would have never guess that using array instead of single value would fix the issue. You save me a lot of waiting time.

---

<div class="post-metadata">

**Author:** ![LuckofBuck](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/luckofbuck/32/677363_2.png) [@LuckofBuck](https://forums.unrealengine.com/u/LuckofBuck)\
**Post date:** [April 29, 2023, 9:15pm UTC](https://forums.unrealengine.com/t/comunication-between-scripts-possible-bug/1123847/5 "2023-04-29T21:15:47Z")

</div>

Also running into this problem. Now wishing I just jammed all my code into one file lol

---

<div class="post-metadata">

**Author:** ![2GHSamburskoy](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@2GHSamburskoy](https://forums.unrealengine.com/u/2GHSamburskoy)\
**Post date:** [May 14, 2023, 12:17pm UTC](https://forums.unrealengine.com/t/comunication-between-scripts-possible-bug/1123847/6 "2023-05-14T12:17:07Z")

</div>

same bug

---

<div class="post-metadata">

**Author:** ![Dr.Joske](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/dr.joske/32/1014311_2.png) [@Dr.Joske](https://forums.unrealengine.com/u/Dr.Joske)\
**Post date:** [October 13, 2023, 2:14pm UTC](https://forums.unrealengine.com/t/comunication-between-scripts-possible-bug/1123847/7 "2023-10-13T14:14:17Z")

</div>

Hey guys, this method works fine for sharing data in one way a-\>b , a-\>c , a-\>b-\>c… but is there a way to make this work in two ways so that I can share from a-\>b and b-\>a ?

When I try that, I am getting some error. “…Linker task graph contains a cycle…”

 ![Screenshot 2023-10-13 161003](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/5/1/951da6441d4799096fff7e04fbf19e6df8e7dea3.png)
