UI interact in separate actor

Add Main Menu (Start, Quit)

Widget:


Create Widget called MainMenuWidget
Add canvas, vertical and, 2 buttons, texts:
image.png
Add events “On Pressed” on 2 buttons
image.png
Create following graph for start and quit buttons:
image.png

BP Actor:


Create a BP class actor called MainMenuWidget
Add Widget Component, put as a root,
Choose Widget class with mainmenuwidget
Scaled down the canvas size if can’t see the menu in viewport:
image.png
Drag the BP in the scene

BP Pawn:


To interact the UI BP menu, create a BP Pawn, name as MainMenuPawn, open it
add the following components:
image.png
Change motion source to right in motioncontrollerright detail:
image.png
Add 2 Widget Interaction Components, name as WidgetInteractionLeft and Right, drag each under its motioncontroller root
image.png
set both trace channel as world dynamic, and either left or right interaction, set pointer index from 0 to 1 :
image.png
Go to Event graph, add new function, name as WidgetInteractioPointer
Create the graph with sequence 1,2 (for left, right controllers)
First, for Interaction left node:
image.png
assign static mesh below on add spline mesh component:
image.png
Continue:

image.png
Drag leftsplinemesh variable, R click and convert to validated Get
image.png
Connect them to branch and sequence as follow:
image.png

Duplicate the nodes applied to right, add new varialble on right spline mesh, and change widget interaction to right

image.png
Connect it to sequence 1
image.png

Back to Event graph, connect the function just made to event tick
Add Input action trigger left and right
image.png

Drag the pawn in the scene, set the auto possess payer and auto receive input as player 0
image.png
Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
CtrlP
) instead.