I’m currently developing an inventory System in c++. The Items are stored in different containers, so I have a TArray of pointers to the containers, so that I can add and remove containers during runtime.
The problem is, when I try to set the target of the pointers in the editor, there are no options to choose from in the drop down menu. The pointer should be set to a component that is attached to the same Object in the Blueprint. Both classes inherit from ActorComponent.
The drop down menu looks like this:
So my question is: Am I simply missing something or is this just not supported? From what I read, it isn’t fully supported, but it can work somehow?
I could set the pointers up in code, but it would be easier to do it in the editor.
The array looks like this:
UPROPERTY(EditAnywhere, SaveGame, Category=“Containers”)
TArray<UInventorySpace*> Containers;
And InventorySpace.h looks like this (I removed the includes here):
UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) )
class SSJUR_API UInventorySpace : public UActorComponent
{
GENERATED_BODY()
public:
// Sets default values for this component's properties
UInventorySpace();
//UPROPERTY(SaveGame)
//TArray<int> inventory;
UPROPERTY(SaveGame)
TArray<UInventoryItem*> Items;
protected:
// Called when the game starts
virtual void BeginPlay() override;
public:
// Called every frame
virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;
};
Any help is appreciated. English is not my first language, so please excuse grammar and spelling errors.