Blueprint variables reset to default

There is an issue after importing from 4.16 to 4.17 that causes an Actor’s ActorComponents to reset instance variables to their defaults, when the actor is referencing a variable from the actor component.

To reproduce:

  1. In engine version 4.16 create a BP_ActorComponent blueprint (parent of ActorComponent). Give it a bool variable called bDefaultOn, make it instance editable. Compile and set its default value to be true. Also give BP_ActorComponent a vector called “SomeVector.”

  2. Create a BP_Actor blueprint (parent of actor). Assign it a BP_ActorComponent created above. Create a function called SomeFunction, that takes in a vector, and just outputs it to a log or something

  3. In BP_Actor, override the Hit Event. Drag a pin from the Hit event and call SomeFunction. Get a reference to the actor’s BP_ActorComponent, then from that get a reference to SomeVector. Use the reference of SomeVector as the input to SomeFunction.

  4. Drag an instance of BP_Actor to the map. In that instance, change the bDefaultOn bool var in that instances BP_ActorComponent to false.

  5. Compile, Save All, and close.

  6. Switch the project to engine version 4.17

  7. Open the project

  8. Observe that the instance actor on the map still has its BP_ActorComponent’s DefaultOn var set to false.

  9. Compile the BP_ActorComponent blueprint. Observe that the instanced actor’s BP_ActorComponent’s bDefaultOn variable is now true/on.

Ive been able to repeat this also with variables stored in blueprint objects. Also, compiling the BP_Actor does not seem to cause this, just compiling the actor component.

I’m having this issue as well with my main project, though I haven’t managed to follow all the steps here to reproduce it in a new and simpler project. My project has moved from 4.15 all the way up to now at 4.17 and involves multiple levels of BP inheritance. Looks like constantly keeping the engine up to date may not be ideal if little things like this happen.

My current workaround is to load up a different map, decline to save, and then load back the map I was in.

I have the same error. There is an easier way to reproduce, without 4.16, see : https://answers.unrealengine.com/questions/707103/compiling-bp-actor-component-resets-all-variablest.html

I can confirm it happens in 4.17.1. Not just with variables, but with “return a boolean value”, which probably uses a variable under the hood. I made some unit tests, that all passed, then I quit UE4 and restarted and suddenly one test started failing…because the checked box unchechecked itself!

This is resolved for me in 4.18

Happening here as well, 4.17

4.22 and still happens. Two years old bug.