Why is bool toggle not toggling from code?

Attached is a visual reference. I have an array of a struct I’ve assembled. It’s called Neighbor List in the shot. You can see the yellow hook likes pointing at the “Cis Open” bool variable I have. The toggle is unchecked but when I hover over I see it’s saying it’s “True”. Additionally “Ais Open” and “Has Been Eval” are unchecked but if I hover over them I’ll see that they are true. Is there something I can do to avoid this? It’s kind of confusing.

Oh additionally, if I look through other array elements the struct on them could have it toggled, This toggling is set from the same loop of code, so why it’s toggling certain indices and not others makes it more odd.

This is normal. What the Yellow hook, as you call it, does is to tell you that the current value of that variable is not the default value. Basically, your AisOpen bool is “True” by default, but it’s currently false. I you hit the Yellow hook, it will return to the default state (true).

So when you “hover over them” you do not see the current state, you see the DEFAULT state.

This variable is currently false. but by default, true.

Another example : let’s say in code you have this:

int32 myIntegerValue = 235;

You will see in the editor the value = 235. But let’s say you decide to change that value to 0. You will notice a Yellow hook appear. When you hover over it, it will say : Reset to Default myIntegerValue = 235, even if the actual value is 0.

I hope my explanation is clear!


Your answer was very clear, thank you. Actually I expected it to be something like that. The problem I have with this is that I set those bools to be false by default when I was declaring that struct. During implementation of other methods they are changed to True. So it appears that it’s suggesting the default is false, because currently it’s true. Which leads me to believe the toggle should be on.

To help illuminate this, take a look at the top image. You will see “Has Been Eval”, “AIs Open” and “CIs Open” have yellow hooks, and are not toggled. However “BIs Open” is also not toggled and it has no yellow hook.

It depends of where you set your variable. If you set it in your declaration like so :

bool myBool = true;

And in the class constructor you do this:

myBool = false;

Then the default property will be false, since this is what the constructor does : set default properties.

However, if elsewhere in the code at runtime you set myBool = true;, it will count as changing it’s default value, and the yellow hook will appear.

This makes sense. So as a brief description of the setup…The “Has Been Eval” is set in the constructor to false. Then, in a method implementation, in only one spot is this value modified. If it hasn’t been evaluated it gets set to true. So using the bottom image as a reference, “Has Been Eval” is not toggled but a yellow hook is there. Shouldn’t the toggled be on because the yellow hook is there meaning it was modified at runtime in that method? No where in my code does it even switch it back to false. It’s a one way switch. Does this yellow hook mean that it was evaluated, but maybe not set to true? Do those yellow hooks appear if the value inside was evaluated in logic period?

I’m not sure I’m following, but changes at runtime are not affecting the editor world. Once you hit stop, the value will go back to what they were before you hit play. Maybe that is what got you confused?

Something strange is going on. the image I’ve posted shows a loop that runs through a list of numbers and finds the inverted pairs, then assigns the index into the struct members Neighbor A, B and C. If I switch the neighbor each part assigns the data into it doesn’t change in the editor. These int32 are in the constructor as default not valued. You can see three different shots where I’ve swapped the names to test them and yet the numbers stay the same in the editor.

This is all on one Actor class. I have a number of UStruct defined that house these members. In the implementation file I have this loop running and it takes numbers from a TArray and loads them into these structs. This is the only place in code that they are modified.

I figured it out, the class was already sitting in my scene in the editor. I guess you have to delete them and then drop them back into the scene in order for them to update completely. Is this by design? Is there another way to refresh your classes. I’m referring to the c++ Classes folder that is in the editor when you have a code project. In there I had drag/ dropped it into the view and it was sitting there for many updates to code. However it wasn’t updating until I deleted it from the scene and drag a fresh one out.

It’s by design, it makes sense when you think about it, you don’t want object with values != default values to change just because you modified the defaults!

Is there a way to globally refresh them? You know, while my coffee brews? Currently I only have one that has some load in it, but I could see some more making their way in. Eventually I’ll probably parse this out to an easy read file and just make a loader for it.