Vectors become zero when compiling data-only blueprint

I have a data-only blueprint which only changes the default values: adds items to arrays, sets vectors and so on. However when I compile the BP then vector variables become zero. Float, enum, array, bool, rotator types are kept.

EDIT: More clues:

  • The issue is only present if the vector variable is part of a struct which is part of an array.
  • Editing another variable with a different type (like a rotator) then editing a vector sometimes makes the vector hold its value after compile.
  • Sometimes the whole problem goes away. I don’t know when or why.
  • Changing the struct or the parent class, restarting the editor don’t invoke/fix the issue.

EDIT #2: The vector I’m having the problem with gets zeroed out if it’s value is (1,1,1). Anything else is fine. o_O

Okay, so this is how it works:

In an array of structs there is an element. In that element there is a numeric variable, part of the struct of course. If that variable has the same value as the default defined in the BP struct then it gets zeroed on compile.

When adding a new item to the array in the data-only blueprint’s “Defaults” panel then the new element’s variable will have their proper default values. However the BP has to be compiled since it has changed. When that happens all numeric variables get zeroed out because they are on their default values.

Non numeric types like strings, materials or enums seem to be unaffected. Also, if the struct instance is not inside an array then the bug doesn’t occur.

The simplest workaround is having default values of 0 for all variables, so the bug won’t change anything in practice.

Could you show us the blueprint?

It seems like this is a small mistake somewhere in the code rather than a intentional or contextual error…
Or it’s straight up a bug in the Engine right now for whatever reason. Anyway it would help seeing that blueprint to help you :slight_smile: