USTRUCT properties in FAnimNode not initialized properly

Hello,

I am having a similar problem to the one posted in this question :

I have a USTRUCT TArray property in FAnimNode, and in the USTRUCT I have other UPROPORTY variables. When I create the AnimNode in the Animation Blueprint, the USTRUCT array has the correct number of elements as I have created in the AnimGraph, however the contents of the USTRUCT is not initialized properly. Below is more details and code definitions:

 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Tasks, meta = (PinHiddenByDefault))
 TArray<FMyStruct> Tasks;

With MyStruct being defined as:

USTRUCT()
struct FIKinemaPenetrationTask
{
GENERATED_USTRUCT_BODY()

 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = FloorPenetration)
     FBoneReference BoneRef;

 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = FloorPenetration)
 bool Penetrating;
 
 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = FloorPenetration)
 bool OffsetHips;

 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = FloorPenetration)
 bool WorldRayTrace;

 /** MeshOffset Depth of the bone/joint inside the mesh */
 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = FloorPenetration)
 float MeshOffset;

 /** Reference frame of Penetration Plane. */
 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = FloorPenetration)
 TEnumAsByte<EBoneControlSpace> PlaneTransformSpace;

 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = FloorPenetration)
 FVector PlanePos;

 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = FloorPenetration)
 FVector PlaneNormal;

};

In the AnimGraph editor, I can edit the BoneReference in MyStruct and when setting a break point in the FAnimGraphNode I see the correct values, however setting a break point in the FAnimNode::Evaluate fuction shows the array Tasks to have the correct number of items but wrong data in its members.

Just as a note, with UE4.3 This works fine with no problem.

Thanks

Hi IKinema,

I have been trying to reproduce this issue, but have not had any luck so far. Are you able to see this behavior in a new project from one of the templates? If so, could you provide the exact steps you are following and precisely where you are putting the code you provided above?

Hello ,

I have not tested on a new project from template. We are developing a plugin and this code is part of a custom animation node that we create. If I have a UPROPERTY() of the struct in the animation node it initializes fine with out any issues. However, having a TArray of the USTRUCTs elements of the array don’t get initialized. Is the initialization of the variables in the AnimNode has changed in any way in latest releases.

I will try to reproduce a minimal reproducible code and report back.

Thanks

Problem resolved on a new project from template. Thank you for your help

Hi IKinema,

I am glad to hear that things are working for you now. If you run into this issue again, and especially if you discover a way to reproduce it, please let us know.