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?
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
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
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!