Structure values set as default in BP disappear after editing structure file

Hello,

I created a structure and then a variable of its type in a BP actor class. I set default values of this structure inside the BP and everything works fine until I change even the smallest thing inside the structure’s asset file, like adding and deleting a new variable there. Then all values disappear in the BP class. It makes working with structures extremely annoying if a lot of data is involved.

Hi Nox_A15,

Would it be possible to get a copy of the struct that you are using, or a representative struct that matches how you have it set up? Where exactly are you making changes, and can you specify an example of the type of change you make, when you see the values being reset? Are you performing a hot reload after making these changes (we still have an open ticket related to hot reloads and structs breaking in Blueprints)?

This has happen to me too. But instead of losing values from a blueprint I lost values in my datatable. It never happened before in 4.11 and now I have to rewrite all of the data again (I didn’t back it up). It was a story script. This makes datatable not very reliable and unsafe to use.

Inside my struct:

Structure

  • Name Variable
  • Text Variable
  • Extra Options Structure
  • -----Sound Wave
  • -----Sprite

So Name and Text are just added variables.
Extra Options is another structure with the variables Sound Wave and Sprite.

In 4.11 I was able to add/change these variables without my data being erased.

But in 4.12 I just change my sound wave to sound cue everything else gets erased.
I test it a few times and it kept happening.

Ok so I did have a backup and when I replace the file all the values stayed and it kept all the changes I made. So now if I need to change the structure I have to make a backup first then replace it after to get all my values in.

Hi ,

Thank you for the additional information. I did some more testing on this issue today using datatables, but was still unable to reproduce the issue. There is probably some small setup detail that I am missing. Would it be possible to get a sample struct and csv file that matches your setup that I can try testing?

I forgot to mention they were all arrays. But I just uploaded the CSV and the uasset structs anyways.
https://drive.google.com/open?id=0B-b4vcNRaktkRDVOQXY5aVdneVk

The breakdown is

  1. -DialogScripts
  2. -----/“StandardText”/
  3. ----------Name
  4. ----------Dialog
  5. ----------Location
  6. ----------/ExtraOption/
  7. ---------------Expression
  8. ---------------Background
  9. ---------------Sound Fx
  10. ---------------Music
  11. ----------/DialogOptions/
  12. ---------------“DialogChoice”
  13. ---------------“RowChoice”
  14. ----------/GetChoiceOptions/
  15. ---------------GetChoiceNumber
  16. ---------------“ChoiceRowCall”

Anything with a " between the name is an array and anything with / is a structure. I hope this helps.

Hi ,

Thank you for the sample files. I had misunderstood how you were setting this up. I thought you were making everything in code. After recreating your structs in the Editor, I now have something that looks like this when I add an instance of the struct to a Blueprint:

I set default values here, and also made a datatable using the primary struct and added a few entries with default values. Then I changed one of the elements of one of the structs and the only default values that changed in the Blueprint and datatable were the ones that I changed in the struct. This was in 4.12.4. Do you still experience this issue in the latest 4.12 hotfix?

Hi, I also misunderstood the title of this post. It is not the default value that gets change but the values of the datatable that gets changed. In 4.11 I was changing the struct and the datatable would hold its information. So I’m assuming in 4.12 now that when you change your struct your datatable values get change to default.

I added a link to youtube video to demonstrate what I mean.
link text

I’m assuming it was intended to do this but I feel it shouldn’t because changing a struct would also require you to redo the database. Especially for me, my database can get really big. Can I make a request to make datatables not set default values when a struct is change? Like it was back in 4.11.

Thanks again.

Hi ,

Thank you for the video that you provided. It gave me the final piece of the puzzle that I was missing. I was able to reproduce the issue that you have described, and have entered ticket UE-32965 to have this investigated further. Unfortunately I was not able to come up with a workaround for this issue.

Workaround: Copy the value of your variable, change the struct, paste the value. Works with arrays of structs too

Hi ,
is there any that this bug get fixed in the near future?
Because it is killing my whole System I’m building based on struct array data each time I change sth. on the structure and I know other devs that have the same problem.

Regards,
Ole

Here is a method to workaround the bug, it works for me. https://answers.unrealengine.com/questions/445559/struct-change-resets-it.html

Hi devandart,

Unfortunately we do not have an expected time frame for this to be corrected yet. You can check the current status of this ticket here.

The work around that SCASL mentioned may work for you in the meantime.

It also happen without any Database but “ONLY with Array of struct”

  • i create simple struct
  • and “use array of this struct” in actor to set variables
  • place actor on map scene
  • setup variable in it

now if i will add or remove new variable inside struct

it will replace all data in all actors on scene with blank default data

  • so i add new variable in stuck and save it
    (struck data in “array of struct” inside actor on scene still exits)

  • now IF i compile Blueprint of Actor which use “array of struct”

it will replace all data with default values inside “array of struct”


BUT “single struct”(not array) still keep variable values and updated as expected

AND if “single struct” have array variables inside - it still wipe all data

i guess some bug with “array” logic…

Hi ScorpyX,

Thank you for the additional information. I have added the information that you provided to the ticket that was entered previously.