Download

Failed to access elements in an array defined in C++ via blueprint

I defined a TArray in C++:
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Camera)
TArray<AItemBase*> Inventory;
and when I try to get some elements from it via BP, the elements are always not valid:

then I change to:
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Camera)
TArray<TSubclassOf<AItemBase>> Inventory;
still not work.