UnrealYAML icon indicating copy to clipboard operation
UnrealYAML copied to clipboard

Read into nested structs with arrays

Open Arise opened this issue 6 months ago • 1 comments

Can I read from an YAML file that contains multiple nested structs with arrays?

I tried to load YAML from file and only the root Image is loaded, but the Clothes array is not. Is this a limitation of the plugin or I just did some error in my loader/processing?

Example below, can I read this into a Cloth struct that has an array of ClothDetails?

Image: Clothes.png
Clothes:
    - Cloth:
        Type: Hat
        Image: hat.png
    - Cloth:
        Type: Shoes
        Image: shoes.png
    - Cloth:
        Type: Pants
        Image: pants.png
    - Cloth:
        Type: Gloves
        Image: gloves.png

I had my structs as:

USTRUCT(BlueprintType)
struct MYPROJECT_API FClothDetailsStruct {
    GENERATED_BODY()

    UPROPERTY(BlueprintReadWrite)
    FString ClothType;

    UPROPERTY(BlueprintReadWrite)
    FString Image;

};


USTRUCT(BlueprintType)
struct MYPROJECT_API FClothStruct {
    GENERATED_BODY()

    UPROPERTY(BlueprintReadWrite)
    FString Image;

    UPROPERTY(BlueprintReadWrite)
    TArray<FClothDetailsStruct> Clothes;

};

Arise avatar Dec 24 '23 09:12 Arise