Why does my behaviour tree reset its task variables

When I close unreal engine and then open it back up all of the variables reset themselves to the point where I have to go into each of the BT’s and reset all of the values to what it should be. This has to be some sort of bug. I know that I have set things up properly as it has worked in the past when I have changed nothing about it, do I seriously have to create a brand new project to fix it?

Hey @Susp_1!

So the default values should be set in the Blackboard attached to the BT. Go ahead and check those default values! When reinitialized the BB defaults will take priority.

Hope it’s that simple of a fix! Let us know how it goes!

I wish it was that easy, it’s not that the default values are different it happens in a task. For example, you have SomeTask, in SomeTask you take in a bool, and in the blackboard there is a bool called SomeBool, when I save the editor and the task is set to use SomeBool, then open the editor again, SomeTask is using SelfActor, even though I had set it to use SomeBool

I found a few forum topics that touch on this, with few solutions, but try this! It seems like it’s been an issue with others as well, throughout the years.

It looks like you may have extra processes running for UE. Try restarting your PC, open UE, go straight to the BT, change a variable to the correct one, save, close, reopen the project and see if that works!

I just tried this, unfortunately it did not help. I also updated Unreal Engine, I then verified, I uninstalled and then reinstalled, nothing has helped. How can I help you help me? What do I need to provide you with?

I personally would just roll back to an earlier version, and try that. Do you have backups?

At the risk of sounding like a workplace safety video, you should always back up your project as often as possible. I hate to say it, but while I was able to find 3 or 4 threads where someone else is having this issue, nobody really has any solutions other than the one thread I found for you (I even checked other forum sites).

This may be something you need to fill out the bug reporting form (located in the menu on the main page of the Editor, OR at Unreal Engine Community) and roll back to an earlier date. :frowning:

Edit: One other thing that came to mind: Are you altering the custom BTTask at the source for the inputs and saving it? Or just changing it in the BT?

I’m changing it in the BT, then saving, closing the editor, then opening the editor again, opening the same BT and everything that I had set is now set to SelfActor

I am having this issue on UE 5.4.1

I’ve also had this issue in the past, I believe 5.3

I posted about is and never got a fix.

You can review that

I am having this exact same issue! My Behavior Tree Tasks have their variables resetting when I close UE and launch it again.

UE 5.4.2. I followed the tutorial here: https://www.youtube.com/watch?v=-t3PbGRazKg

I have recreated the Behavior Tree and its Blackboard from scratch, and the exact same thing happens on this behaviour tree.

Moreover, whenever I fix the values (doing nothing else after the launch of the editor) and view the changes in Revision Control, the diff has nothing to do with the broken BTT!

This is the diff that UE detects after fixing the variable values, and please note, neither of these tasks are the ones I changed, and their values were fine:

This is the task (there is a second instance of it in the BT) that always has its Movement Speed set to Idle (instead of what you see here). Changing this value from IdleMovement Speed resulted in the diff above! :exploding_head:

This is breaking any ability to even follow a tutorial :smiley: I will try next by creating a new Behavior Tree Task to see if the current one is corrupted somehow?

Collecting other instances of this problem:

https://www.reddit.com/r/unrealengine/comments/15kzt1l/why_does_my_behaviour_tree_reset_the_blackboard/

There is no apparent resolution. My temporary workaround will be to create a function per-variable-value I would have used (so BTT_SetMovementSpeed_Walking and BTT_SetMovementSpeed_Sprinting). This should not use variables in BTTs.

When trying to do that, it shows that UE5 is treating these Tasks as some sort of persistent value. This forum post describes this phenomenon: Variables in Behaviour Tree task. What I mean is that until I restart the editor, I will see the variables showing up in the Behavior Tree Details panel, even though the variables were deleted from the BTT and the BTT was compiled + saved!

I can confirm that flattening the variable options I’d like to use into individual functions works around this bug, but that is super super annoying and won’t scale for anything beyond simple enums.

Did you try for the tasks in question to go file->refresh all nodes and compile again?