ue4 c 2b 2b how to open a blueprint widget

Solutions on MaxInterview for ue4 c 2b 2b how to open a blueprint widget by the best coders in the world

showing results for - "ue4 c 2b 2b how to open a blueprint widget"
Lucas
21 Jan 2017
1    // Where menu might be your widget.
2    Menu->AddToViewport();
3
4    // Step 0 get player controller.
5    auto PlayerController = GetFirstLocalPlayerController();
6    if (!ensure(PlayerController != nullptr)) return;
7
8    // Step 1 setup an input mode. There are multiple such as game only or game and UI as well.
9    FInputModeUIOnly InputModeData;
10    // Step 2 config is specific to the type
11    InputModeData.SetLockMouseToViewport(false);
12    InputModeData.SetWidgetToFocus(Menu->TakeWidget()); //Because UMG wraps Slate
13
14    // Step 3 set the mode for the player controller
15    PlayerController->SetInputMode(InputModeData);
16
17    // Step 4 enable cursor so you know what to click on:
18    PlayerController->bShowMouseCursor = true;