"Watching values" are wrong

Recently I programmed a bit and there I had a strange bug (this bug has nothing to do with this bug that I am describing now).

The first thing was that I debugged my own code (with the option “Watch this value” and hovering with the mouse cursor over the variable in the Blueprint Editor).
I had to search for a long time because the wrong values was presented to me (in the Blueprint Editor)

I have create a new Blueprint only Project and experiment a little bit with it and could reproduce this bug.

I have created a TestActor and placed one instance in my level with the name StaticTestActor

This is the overview of my TestActor and my level:

This actor has only this code nothing else.

Inside the actor

First of all I have created a bool with the name BoolTest.
I have set the default value from this bool to true.
Also I ticked Instance Editable, Blueprint Read Only and Expose on Spawn.
You can see the defaults in the overview image.
Now i can change this variable when a new actor will spawned but not when the actor is already spawned (Blueprint Read Only).

Debbuging time

I have ordered my code in three steps A, B, C1 and C2.

In Step A I have described it what happened.
I use this bool for the inifinity loop problem and for the bug.
In Step B I spawn a new actor with the same class from my TestActor.
Also I set the value from BoolTest to false (see Step A).

So now comes the step where the bug happens.
I have created two steps for the last step. In the Step C1 you can see the bug.

Now I replace the Step C1 with Step C2.
Here you can see a example where this bug is really misleading and annoying for debbuging.
What do you think what string will be printed to the screen?
If a bool with the value true comes to a branch.
Right :slight_smile: Not what you expected, “False” will be printed to the screen

Everything was called in one frame and the bool is also Blueprint Read Only, nothing can change this value at this point.

Luckily this bug is not game breaking because the value is correct. I have set this value in Step B to false,
only for debugging. But if you dont now that, then you can think that your code has a issue.

Solution

I believe the watched values are from the actor where you are debugging from. Because the debugging actor has the same variables (of course) but with other values. And the BoolTest variable from the debugging actor has the value set to true (see Step A).

Extra

This bug is not only reproduceable with a bool variable.
All Unreal Engine 4 variables show this bug and also arrays, custom enums and custom structs.

Her is a integer variable:

Thanks for reading and sry for my english. I am not a native english speaker.

Is this a Unreal Engine 4 bug or not?

Hello,

We’ve recently made a switch to a new bug reporting method using a more structured form. Please visit the link below for more details and report the issue using the new Bug Submission Form. Feel free to continue to use this thread for community discussion around the issue.

https://epicsupport.force.com/unrealengine/s/

Thanks

Hi there, I just want to say you are not alone, This is happening to us too and we have no clue what to do.
Something similar happend to me some time ago too>

Did you open a bug report with the link provided by Jeff A?