This is for looting range for the player. A bool value is set to true when the player enters a triggerbox and false upon leaving (false on default). In the character controller the player can loot if (true) and not if (false). However, the bool-getter-function is causing the engine to crash.
Error: Fatal error: …RightMouseButton is not being constructed with either NewObject, NewNamedObject or Construct
Expected behavior: I want the get function to return a boolean from the Pickup class.
Observed behavior: Engine crash upon clicking Right mouse button (bound key to Interact function)
Steps to reproduce: Trying to call a function from another class by doing what ever i am doing.
What has been tried already: I’ve obtained wanted result outside ue4.
Useful info: ue4 v.19, vs: v.15.7.6
c++ Character
// Input setup
void APlayerCharacterController::SetupInputComponent()
{
Super::SetupInputComponent();
InputComponent->BindAction("Interact", IE_Pressed, this, &APlayerCharacterController::Interact);
}
// Called on RightMouseButton
void APlayerCharacterController::Interact()
{
APickup PickupClass;
if (**PickupClass.GetInLootRange()**)
{
if (CurrentInteractable)
{
CurrentInteractable->Interact(this);
}
}
else
{
UE_LOGS(LogTemp, Warning, TEXT("Out of loot range"))
}
}