Create a gamemode base BP, called MainMenu Game Mode
Change game mode override:
Drag Player Start in the scene
Create a Actor BP called BP_Menu3D
add 2 components and move the camera a bit
Set Parents and Child Widgets:
Create a widget called Menu3D Widget
Go to Graph, class setting, tick Generat Abstrat Class (avoid directly spawn into world, only spawn children of it)
Add Event dispatchers
Create a new widget called Button Widget
Create a new widget called MainMenu Widget
Open it, go to class setting, add the parent class:
Duplicate the Widget 2 times, rename as follow:
Create Button Widget:
create variable text, set as
Drag Get Button Text first, then type set SetText node, connect as:
Use variables and nodes to control hover colors:
Create hover and unhover events on button variables, make graph as:
Set Hover Color variable as editable and private
Repeat the same on unhover node, change background color to RGB and alpha 0
Create Click event on the button variable, add dispatcher, and set graph as:
Create MainMenu Widget:
In Design:
Rename those button widgets
Go to the scene, drag BP menu 3d actor to location where wants to show menu
Set the widget class to mainmenu widget
Set the draw size same as in main menu widget (set in custom)
Rotate the widget 180 degree in Viewport in BP menu3d actor
move the widget to fit the camrea view in scene
Set starting from the camera actor view: (Set Input Mode Game and UI node)
Open level BP:
Select the BP actor in scene
Unitck hide cursor during capture
Go to BP Menu3D event graph, add custom event (to disable old widget once click to new one, and transit the camera view to new target)
Back to Level BP
Test the play mode now, now the mouse can’t click on button
Fix it to go to BP menu 3D, Widget component, turn on Receive Hardware input in interaction
Duplicate the 3D menu BP actors in other places in the scene
Set NewGame Widget Design:
Set Option Widget Design:
make sure both widget set the parents and untick generate abstract class in Class settings, or else they won’t show when choosing below for each BP actor:
Assign each BP Menu3D actor with corresponding widget
Link different menu widget with array variable
Back to BP menu3D
Add variable (for linking to different menus)
Go to BP main menu in scene, now can add array in default in details:
In 2nd BP menu, add 1 array (coz only 1 button is needed for going back to main menu)
Repeat the same on remained BP Menu
Go to Menu3D widget, select the transiton to linked menu dispatcher
Add input parameter (click + button) in dispatcher created earlier on (to specific which menu to switch to)
Go to main menu widget, called the graph as below:
(Menu index number depends on how it sets at the BP mainmenu BP in details:)
Back to BP Menu 3D actor, modify event graph (plus the linkmenus variable, can create and connect more menu ui easily):
Set those menus (i.e. New game menu and Option menu) with Back button as:
To don’t let other widget menu work when we are on the assigned widget menu:
Disable collision
Go to BP Menu 3D
Add Set Actor Enable collision node as below