PrimaryAsset reference in UserDefinedStruct default values gets nulled

Greetings! We encountered an error loading default values for blueprint structure variables and, fortunately, we managed to assemble a minimal repro case.

Here’s the layout that leads to error(tested on both 5.6 and 5.7):

1) Blueprint class that inherits PrimaryAsset (DA_AssetClass in repro project)

2) Blueprint struct with a variable of type DA_AssetClass (S_UserDefinedStructure)

3) An asset of DA_AssetClass (DA_Asset)

4) Blueprint class of BTT_BlueprintBase with an exposed variable of type S_UserDefinedStructure (BTT_BTTask)

5) BehaviourTree asset with the above task(BT_BehaviourTree)

After loading the project if we first open S_UserDefinedStructure and then open BehaviourTree then everything is ok. But if we first open BT_BehaviourTree we can see that the inner variable of S_UserDefinedStructure that held DA_Asset is now null and you get the followig error in output log.

LogProperty: Error: FStructProperty::Serialize Loading: Property ‘StructProperty /Game/BTT_BTTask.BTT_BTTask_C:AbilityData’. Unknown structure.

LogClass: Warning: Struct Property AbilityData has a struct type mismatch (tag STRUCT_REINST_S_UserDefinedStructure_4(/Engine/Transient) != prop FallbackStruct(/Script/CoreUObject)) in package: /Game/BTT_BTTask. If that struct got renamed, add an entry to ActiveStructRedirects.

LogProperty: Warning: Serialized BlueprintGeneratedClass /Game/DA_AssetClass.DA_AssetClass_C for a property of LinkerPlaceholderClass /Game/S_UserDefinedStructure.PLACEHOLDER-CLASS__DA_AssetClass_C_0. Reference will be nulled.

ReferencingObject \= UserDefinedStruct /Game/S\_UserDefinedStructure.S\_UserDefinedStructure

Property \= ObjectProperty /Game/S\_UserDefinedStructure.S\_UserDefinedStructure:PrimaryAsset\_10\_620218C04F61459D99F1D0A6AB388374

Item \= DA\_AssetClass\_C /Game/DA\_Asset.DA\_Asset

LogClass: Warning: Struct Property AbilityData has a struct type mismatch (tag FallbackStruct(/Script/CoreUObject) != prop S_UserDefinedStructure(/Game/S_UserDefinedStructure)) in package: FObjectReader. If that struct got renamed, add an entry to ActiveStructRedirects.

Please, suggest a way to fix the issue or maybe a temporary workaround while we’re waiting for a fix.

Thanks in advance!

[Attachment Removed]

Steps to Reproduce
Repro:

1) Open project

2) Open BT_BehaviourTree

3) Click on a BTTask and check AbilityData value.

Expected result: AbilityData has innner property PrimaryAsset with value DA_Asset

Actual result: AbilityData.PrimaryAsset value is null and there’s an error in output log

[Attachment Removed]

Hi there,

Thank you for your repro project & steps. It’s worth noting that I would also get the error/warnings when opening BTT_BTTask. Did you also see this?

I was able to fix this issue in a few steps & I’m curious if you had tried these:

  1. I found that once the value on the task has been reset the value to DA_Asset. it will no longer reset when the BTT is opened for the first time after editor launch. although the error still appears. Additionally when using BTT_BTTask in other behavior trees I no longer had this issue of the property value becoming null.
  2. Modifying the AbilityData property inside BTT_BTTask (e.g renaming it or changing it temporarily to an array) would stop the error in the output log from appearing.
  3. Changing the pointer within the structure to a soft object reference would remove the remaining warnings. This might not be applicable in your situation but this is also how I would recommend passing around references to .uassets rather than a hard pointer.

Let me know if these fixes work for you or if i missed anything.

Cheers,

- Louis

[Attachment Removed]

Hello, thank you for such a quick reply!

Unfortunately, the workaround you suggested doesn’t work for us, since the case shown in the repro project is a heavily simplified part of a much larger feature, where the structure is stored as an FInstancedStruct, and renaming it is not an option.

Similarly with the reset value — this feature is used quite frequently, so the content team would not be happy with such an addition to the pipeline.

Is there perhaps any way to fix this in the source code?

[Attachment Removed]

Hi again,

To me this seems like a case where the engine doesn’t recognize your struct anymore. This could happen for many reasons but the reason I suggested some of those workarounds was to get the engine to recognize your struct again by temporarily modifying it. I understand that in a larger project that could be infeasible.

I was hoping you could explain how you created your repro project. Did you take the original project and strip it down or did you recreate this in a fresh project? Attempting to recreate it myself I did not get the error and warnings.

Is this issue a singular one or is this quite prevalent among many assets/tasks in your main project?

Cheers,

Louis

[Attachment Removed]

In our case, the error occurs with BehaviourTree assets and GameplayAbility Blueprints. Different fields in various structures get broken, but what they all have in common is that all the affected fields are of a type derived from PrimaryDataAsset — although I’m not completely sure that this issue is strictly related to PrimaryDataAsset itself.

The repro project was created from scratch — I just recreated simplified versions of the files from our failed tests. Just in case, here’s the step-by-step process:

1)Created a Blueprint asset class derived from PrimaryDataAsset.

2)Created an asset of the class from step 1 via Miscellaneous → Data Asset.

3)Created a Blueprint structure and added a property with the type from step 1, assigning a default value from step 2.

4)Created a BehaviourTreeTask class and added a field with the type of the structure from step 3.

5)Created a BehaviourTree and added the task from step 4.

Then, after restarting the project and opening the files in the specified order, we get this error.

[Attachment Removed]

Thank you for this additional information. I have enough now to submit a bug report for this issue. Once it is publicly available you should be able to track it here.

- Louis

[Attachment Removed]