Download

Blueprint Not Holding Variable Value Between Instances

Hey folks,

I’m stumped and being driven steadily out of my tiny little mind. I was following a UDEMY tutorial, and the authors are being helpfully silent, so hopefully someone here can help! Apologies if this explanation is tricky to follow:

The tutorial is an endless runner style game in which you drop down a series of randomly generated platforms. There’s a blueprint for the ‘Top Platform Set’ and one for the ‘Upper Platform Set’, as it is referred to in the tutorial. Each set contains a few rows of platforms, and some bp scripting decides which ones are visible.

There’s one Top bp in the world and two Upper bps below it. The logic is that when you land on the third (of five) platform rows on the second Upper bp it uses the Teleport node to move the first Upper set below the current set and reruns the function that decides where the platforms are.

As there’re two Upper sets, there’s a boolean in place, IsFirstRun. This is supposed to be on for the first one, and then of course switched off for the second, allowing the function where the set is moved to run.

For some reason, I cannot for the life of me get this boolean to change and stay changed between the two platform sets. Despite after the first function (with no move) it sets the boolean to false, it still appears to be on as I enter the second instance of the blueprint - as if it’s reverted to its default value of On.

Does this sound familiar? Numerous instances of the same blueprint resetting variables changed in earlier versions? I’ve tried it with floats and integers instead of booleans, and looking for matching or less than figures too but with no luck.

Apologies this is long winded, I’m at work so don’t have screenshots. If anybody has any advice at all it would be greatly appreciated!

Cheers!

Rob

It could be a number of things, but if you’re able to redo the affected BP and it doesn’t break then you’ve hit the most painful bug in UE4 shy of a project becoming corrupted. This is, but shouldn’t be, just a reality of working in BP. You should never base a BP class on a BP class.

Thanks for the reply KorkuVeren. I think that bug is what it is. Read further and found other people discussing the same effects so tried it again, and yeah it worked. At least it’s sorted now!