Variable is not in scope

I have 2 BP:

  1. MySwitcher_BP has a public editable boolean variable called IsChanging
  2. Another BP that tries to read (unsuccessfully) this variable

Debbugging and doing the “watch this value” I noticed that editor tells me that Variable is not in scope, so the flow of execution is totally compromised.
I’m sure that the reference to MySwithcher is correct because its current value is updated once I am on that node, but I cannot understand why the IsChanging variable is out of scope if I already have the reference to the instance…

Am I doing something wrong?
How can I solve this problem?

Not sure what could be wrong because usually it works out of the box. You don’t even have to make the variable Instance Editable, that is for editing it from the Details panel.

Try this: remove the ForEachLoop and simply do a Get (copy) and take the first value of the array (index 0) out of Get All Actors of Class. Cast the element to MySwitcher. Do a Branch and add two Print String, one for True and one for False of isChanging. Then go back to instance of the MySwitcher BP and change the value of isChanging to try out both options. Does it work as expected?

Are your BP both in the level?

Similar question here might be of some help

Well, actually I changed that code completely, but still I check the boolean values. My code now is working properly, despite at Debug time those variables are marked as “not in scope”, but if I use the Print function I can see on the screen the value. Probably it’s a bug of the engine, since the logic now is working totally fine!

I also encounter this a lot (UE4.18.3). Print nodes reveal that the variables are as expected, but the blueprint reports them as “not in scope”. This also prevents the Blueprint Debugger from displaying any watched variables. I haven’t pinpointed when this behaviour starts for me, but it just happens suddenly and then I can’t seem to correct it.

2 Likes