Class GameDev* SheepAdult

[Unreal Engine] TMap 에 TArray 등 Nested container 저장하는 방법 본문

Unreal Engine

[Unreal Engine] TMap 에 TArray 등 Nested container 저장하는 방법

SheepAdult 2023. 1. 28. 21:12

 TMap Container에 TArray를 Key나 Value로 저장하려고하면 Nested Container이기 때문에 저장할 수 없다고 에러 메세지가 뜬다. 이럴 경우 USTRUCT를 하나 선언한 후 이 안에 Nested Container를 담으면 된다.

 

아래는 예시 코드이다.

USTRUCT()
struct FTest
{
	GENERATED_BODY()

public:
	UPROPERTY()
		TArray<FTransform> Transforms;
};

USTRUCT(Atomic, BlueprintType)
struct FLevel1Struct
{
	GENERATED_BODY()

public:
	UPROPERTY()
		TMap<class AChessBoard*, FTest>TestData;
}