Set Variable Between Blueprints from Construction Script

Hello,

Is there a way to set variables between blueprints using the Construction Script?

For my system I want to set the value of a bool in Blueprint A to another value decided in Blueprint B using the Construction Script. Both blueprints are inside the level. Here’s it my attempt:

With this method you can easily get the values of variables inside other blueprints however I seem not to be able to set the variables from other blueprints.

Is it a limitation of the Construction Script or is there a way to achieve this?

Thanks for your help!

Have you set the Refresh variable to editable? Perhaps this solves it.

yes I have and no it doesn’t - I also tried it with expose on spawn but that didn’t help either…

I tried to reproduce this failure, but it works - whenever the construction script is run, it sets the variable to true. Have you tried to check the actor reference from the “Get” node with a “IsValid” node? How do you check that “Refresh” isn’t true?

There is a way to do it but you need to pay attenction when use this method:
Blueprint A need to have a Branch that get Refresh Blueprint B set by default to false and if you click to enable it it become true so construction script continue fairing set variable and if you dont reset refresh condition your engine crash.
Next you need a variable to ref the blueprint B and from it set the variable inside the blueprint with new 1 from Blueprint A

In blueprint B you can do the same think take a variable from A and set it with 1 in B and viceversa you can take variable for your need by get it

Before place both blueprint save all becouse if you made a mistake in costruption script it generate infinit loop so your engine crash, before test it save all and place both bp in your scene

Now you need to set in BLueprint A the ref to blueprint B

Now set Blueprint B ref to Blueprint A

Now the comunicazion between construction scripts was set up and you can try to test it

Now you ready to test it just assign new value for the variable and press refresh other blueprint

And you see that the comunication between both construction script work fine

Again be free to use this trick but before test any change save your project. Durning the creation of this test I made 1st time a mistake and i needed to repeat all from 0.

Thanks for the answer. I found the problem now. The reason it didn’t work in my case was that I expected the other script to destroy itself and spawn in again like it would when you change the variable inside the details panel. But apparently changing the variables using another blueprint will not do that. I have now created another function inside the construction script which can be called from another blueprint… all works fine now! Thanks again!

can you go into more detail on this? I’m trying to do the same thing. I want to re-run the construction script on a blueprint via another blueprint