I’m creating an item/inventory system. At this point I got items spawned in the world, but now I want to click on the object/mesh of the item to pick the item up and put it in the inventory. I’m stuck at how to detect which object/BaseItem is being clicked.
I tried the following code in the constructor of my BaseItem class:
//Create the static mesh component ItemMesh = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("ItemMesh")); RootComponent = ItemMesh; ItemMesh->SetSimulatePhysics(true); ItemMesh->OnClicked.AddDynamic(this, &ABaseItem::OnClicked);
The Onclicked.AddDynamic gives me an error:
Error (active) no instance of function template “FComponentOnClickedSignature::__Internal_AddDynamic” matches the argument list
I want to store the clicked BaseItem in a variable so I can add it to the Inventory array
Thanks in advance!