Node like that would make debugging shenanigans with input modes much easier.
Announcement
Collapse
No announcement yet.
GET Input Mode node
Collapse
X
-
I know this is an old post, but I needed this myself - so I came up with something like this does the trick. It is missing some information you'll need to set the mode back later (like capture, and mouse lock), but this at least lets you know which of the 3 modes you are currently in. It returns an integer, not a mode itself.
0 = Game and UI mode
1 = UI Mode only
2 = Game mode only
Code:// In the .h file: UFUNCTION(BlueprintCallable, Category = "Runtime Inspector") int GetCurrentViewMode(const APlayerController *PlayerController); // In .cpp file (best in a blueprint function library) int UMyFunctionLibrary::GetCurrentViewMode(const APlayerController *PlayerController) { if (IsValid(PlayerController)) { UGameViewportClient* GameViewportClient = PlayerController->GetWorld()->GetGameViewport(); ULocalPlayer* LocalPlayer = PlayerController->GetLocalPlayer(); bool ignore = GameViewportClient->IgnoreInput(); EMouseCaptureMode capt = GameViewportClient->CaptureMouseOnClick(); if (ignore == false && capt == EMouseCaptureMode::CaptureDuringMouseDown) { return 0; // Game And UI } else if (ignore == true && capt == EMouseCaptureMode::NoCapture) { return 1; // UI Only } else { return 2; // Game Only } } return -1; }
Last edited by G_t_Pianoman; 11-01-2018, 09:32 PM.
- 3 likes
Comment
Comment