I’ve set up an inventory toggle input, and when the button is pressed, all the inputs coming from the player need to be disabled, on top of ignoring look and move inputs. I specify “player” here because I have axis inputs defined in the controller while actions are bound in the player character class
Code
void AProtagonistController::ToggleInventory()
{
if(!bIsInventoryOpen)
{
WidgetInventory->AddToViewport();
aControlledCharacter->DisableInput(this); // This is the Character actor controlled by this player controller. This is also the line 86 referenced in the crash log
SetIgnoreLookInput(true);
SetIgnoreMoveInput(true);
bIsInventoryOpen = true;
bShowMouseCursor = true;
bEnableMouseOverEvents = true;
}
else
{
WidgetInventory->RemoveFromViewport();
aControlledCharacter->EnableInput(this);
ResetIgnoreLookInput();
ResetIgnoreMoveInput();
bShowMouseCursor = false;
bEnableMouseOverEvents = false;
bIsInventoryOpen = false;
}
}
Unhandled Exception: EXCEPTION_ACCESS_VIOLATION 0x000000003f800000
UnrealEditor_Project_patch_1!AProtagonistController::ToggleInventory() [C:\Users\user\Documents\Unreal Projects\Project\Source\Project\Private\ProtagonistController.cpp:86]
UnrealEditor_Project_patch_1!TBaseUObjectMethodDelegateInstance<0,AProtagonistController,void __cdecl(void),FDefaultDelegateUserPolicy>::Execute() [C:\Program Files\Epic Games\UE_5.0\Engine\Source\Runtime\Core\Public\Delegates\DelegateInstancesImpl.h:594]
UnrealEditor_Engine!FInputActionUnifiedDelegate::Execute() [D:\build\++UE5\Sync\Engine\Source\Runtime\Engine\Classes\Components\InputComponent.h:288]
UnrealEditor_Engine!UPlayerInput::ProcessInputStack() [D:\build\++UE5\Sync\Engine\Source\Runtime\Engine\Private\UserInterface\PlayerInput.cpp:1419]
UnrealEditor_Engine!APlayerController::ProcessPlayerInput() [D:\build\++UE5\Sync\Engine\Source\Runtime\Engine\Private\PlayerController.cpp:2609]
UnrealEditor_Engine!APlayerController::TickPlayerInput() [D:\build\++UE5\Sync\Engine\Source\Runtime\Engine\Private\PlayerController.cpp:4762]
UnrealEditor_Engine!APlayerController::PlayerTick() [D:\build\++UE5\Sync\Engine\Source\Runtime\Engine\Private\PlayerController.cpp:2234]
This behavior happens at random so I have no idea how to reproduce it