TMapにAdd()しようとするとエディタがクラッシュします。
以下がエラーのあった箇所です。
.h
UCLASS()
class TESTPROJECT1_API TestManager : public AActor
{
GENERATED_BODY()
UPROPERTY(EditAnywhere)
TMap<int32, AActor*> TestMap;
public:
void SetTestMapElement(AActor* TestActor, const int32 x, const int32 y);
};
.cpp
void TestManager::SetTestMapElement(AActor* TestActor, const int32 x, const int32 y)
{
const int32 Index = x + y * 30;
TestMap.Add(Index, TestActor);
}
TestMap.Add(Index, TestActor);のところでAccess Violationエラーになります。
TMap変数にメモリが割り当てられていないことが原因なのかなと思うのですが、TMapやTArrayを初期化するための処理はありますでしょうか。
ドキュメントを読んだだけでは分からなかったため、詳しい方にUEコンテナ群の扱いをご教授願いたいと存じます。
宜しくお願い致します。