Struct variables accessed through casting break when re-opening project

4.6.1, Win 7 64 bit.

When you cast to an actor in a blueprint, and then get a struct variable from it and either break it out, or connect it in some way to another node, it will break upon re-opening your project.

EDIT: Narrowed bug down a bit, original repro steps are left below for reference but I no longer believe them to be accurate. I now believe issue was related to changing a struct definition, which left references to it in casting target dirty or corrupt. I was able to resolve this issue in one case, but in another case I had to completely recreate variable, and lost some data in process.

In conclusion, it looks like this bug is result of updating a struct’s definition in editor when that struct is being referenced in a blueprint.

In general, it still seems very unsafe to make any changes to a struct’s definition in editor as it still creates a lot of bugs in blueprints that use that implement it more often than not. This is definitely an area that needs some work in regards to usability of structs in editor.


Repro:

  1. Put a struct var in an actor

  2. Cast to that actor in another

  3. Break out struct var and hook it up to something

  4. Save and re-open

  5. Connection is broken

,

I wasn’t able to reproduce this. I created a Struct, made a variable of its type in a BP, then cast to that variable from another BP. Then I changed default values of Struct and added another variable. After saving/compiling everything and shutting down editor, reopening project did not break anything.

Am I missing any repro steps? Does this happen consistently for you? Does it happen in a new project, or only your existing project? Any other details to help reproduce it would be great. Thanks!

, thank you for reply. To answer your question, no, it doesn’t happen consistently, many times you can edit struct definition and it works just fine. It seems to be sort of thing that may only happen to certain instances of struct in certain blueprints, and others are fine. It’s kind of a hard one to pin down.

I’ll try to spend some time seeing if I can narrow down repro steps.

I’ve seen this happen to me once before when initial declaration of USTRUCT didn’t include BlueprintType (e.g. it was just USTRCT()) and then I still managed to access struct using some other Blueprint node function in Blueprint graph. Subsequent changes to UStruct caused Blueprint graph pins to break. Adding BlueprintType and re-saving fixed it.

Hey ,

Is this a code project? Can you check whether cancel’s response is applicable for you?

It is a code based project, but structs are defined in editor and not in code so I don’t think this applies.

Okay, let me know if you can narrow it down. If you’re able to recreate it in a test project for me, that would be helpful as well. Thanks!

Note: just marking this resolved for tracking purposes. Replying will reopen it, so please feel free to do so if you have more information for me.