Works as expected if it’s placed in any BPactor graph or in the Level Blueprint.
When playing the level, I start with “false” (default value) printed every tick. Ok. Pressing E key, it changes to “true”, until I press E again, and so on. No suprise.
But the same exact code placed in a FirstPersonCharacter event graph gives different results:
I get “false” printed. (the default) But, when I press E, the Banner variable starts swapping every tick. And the log looks like this:
true
false
true
false
true
false
true
false
Until I press E again, then stablizes in false, as expected.
Any explanation? I can keep working placing this function in the LevelBlueprint and it works. But I’m coding player behavior, the right place for this code is the FPC graph. And, anyway, I’d like to understand what’s going on.
That’s a point! E is part of the InputAxis, that key behaves different to others, sending continuous data while pressed. But I got tick-swaping banner even after pressing the key, until I pressed again.
As soon as I get back to the project I’ll take a look.
Just tested and no, it was not because I was using an inputaxis key.
The same exact weird behavior using any other key event.
Not a big deal, just sent that variable control somewhere else and it’s working. But I’m curious, Id prefer to understand why, not always there such an easy workaround to things I don’t understand.
That variable I was using in my example was created just for the test, to be sure no other BP was messing.
But youre right. I think that project is in someway corrupted. I’ve been testing (and learnig, I’m a beginner) different gamemodes and pawns, also changing names to many variables, or moving code from one place to other, and being an agent of chaos for days ( :
In fact, later today that project suddenly refused to package anymore, with a thousand yellow and a hundred red lines in the log. WTF! I migrated the level to another new project and packaged seamless.
Thanks for your help, Clockwork. If you convert your comment into an answer I’ll mark it as solved.