-

How To Make A Menu For A Game With Multiple Levels Unreal Engine 4

Learn How To Make A Menu For A Game With Multiple Levels Unreal Engine 4. Learn How To Spawn A Character In A Game With Multiple Levels.

How To Spawn A Character In A Game With Multiple Levels

It doesn't matter how many levels your game has, the character will always spawn at the PlayerStart actor position, if you do not have a PlayerStart actor in the level you can always drag one from Modes panel. In a level without a PlayerStart or a NetworkPlayerStart (for multiplayer), the character will spawn by default at 0 coordinates on all axes. The character can also spawn at a Target Point actor position, but you need to script a system for that to happen, if you want to spawn the character at a number of Target Points in the same level and have a menu for that, you can read the following article How To Spawn Character Target Points Menu Unreal Engine 4

How To Make A Menu For A Game With Multiple Levels

Next, you will learn how to add menu buttons for a game that has multiple levels, if you want to learn how to make a menu here is the link to do that How To Create A Menu (Main & Pause Menu) Unreal Engine 4 - after, you have a menu, we can add the menu buttons.

We will add to the menu a levels page, were the player will be transferred after pressing the play button, on this page the player will be able to select a level out of three. To create the levels page we will use a widget switcher (I find it much better then the recommendation made by Unreal Engine 4 documentation of the widget visibility system). Drag from Palette a Widget Switcher, add to it two Canvas panels, you need to rename the Canvas panels in the Details Panel, name them 0 and 1, set for each Canvas panel the visibility to Visible (in the Details Panel > Behavior > Visibility). Select the Widget Switcher, go to Details panel, in the Slot section next to Anchors select the full page Anchor, next to Position X type 0 - next to Position Y type 0 - next to Size X 0 - next to Size Y 0.

Now, select the Border and the two Buttons from the menu example and drag them in the Canvas Panel 0. Next, add a new Border and three Buttons with Text in the Canvas Panel 1, replace the Text Block for each button with Level 1, 2 and 3.

Select the Border in the Canvas Panel 1, go to Details panel, in the Slot section next to Anchors select the full page Anchor, next to Position X type 0 - next to Position Y type 0 - next to Size X 0 - next to Size Y 0, under Appearance > Brush > double click the Tint bar > in the Hex sRGB type 000000FF

Select the first button in the Canvas Panel 1, go to Details panel, next to Position X type 800 - next to Position Y type 300 - next to Size X 300 - next to Size Y 100 - next to ZOrder 1, select the second button, go to Details panel, next to Position X type 800 - next to Position Y type 500 - next to Size X 300 - next to Size Y 100 - next to ZOrder 1, select the third button, go to Details panel, next to Position X type 800 - next to Position Y type 700 - next to Size X 300 - next to Size Y 100 - next to ZOrder 1

Select all three buttons in the Canvas Panel 1, go to Details panel, under Appearance > Style > Normal > double click the Tint bar > in the Hex sRGB type 6B6B6BFF - do the same for Style > Hovered and Style > Pressed.

Now, the visual part is ready, we will start scripting the menu buttons for a multiple levels game. Before, we start, let's create two new levels. Let's say that you have selected the Third Person Project with Starter Content, then go to the Content Browser > ThirdPersonBP > Maps > select the ThirdPersonExampleMap, click RMB and select Duplicate, do the same steps one more time, now, we have three levels called ThirdPersonExampleMap, ThirdPersonExampleMap1 and ThirdPersonExampleMap2.

Scripting The Menu Buttons

Next, select the Level 1 button, go to the Details panel, under Events section > click LMB on the green button next to On Clicked, you will be transferred in the Graph editor, were you will see your newly created event, from here go in the right corner up and select Designer, this way you will be switch back to the Blueprint Designer Mode, were you will need to select the second button (Level 2) and third button (Level 3) perform the same steps as for the first one.

Now, in the Graph editing mode select the event for the Level 1 button and add an OpenLevel node, set it to ThirdPersonExampleMap, add a Get Player Controller node, off the Get Player Controller, use Set Input Mode Game Only, then, add a Remove from Parent node at the end, connect the OpenLevel node with the Set Input Mode Game Only node, select the event for the Level 2 button and repeat the steps with a small difference, instead of the ThirdPersonExampleMap add ThirdPersonExampleMap1, same for the Level 3 button (add ThirdPersonExampleMap2).

In the Graph editing mode select the event for the Play button and remove the OpenLevel node and the Remove from Parent node at the end. Go to My Blueprint panel > Variables > Select the Widget Switcher and add a Get the Widget Switcher in the Editor Graph, from it drag and add a Set Active Widget Visibility node, next to the Index pin replace the text with 1 (this will open the Canvas Panel 1 when the Play button is pressed), connect the Play button event to the Set Active Widget Visibility node. If you want to create a Return To Main Menu button on the Canvas panel 1 you need to repeat the steps for the Play button and in the Set Active Widget Visibility node next to the Index pin replace the text with 0.

Congratulations! You have a menu for a game with multiple levels, if you have questions or you need additional help, contact me by posting a comment in the comment section below or through the contact page.

Interesting articles to read on Edvog.com
Unreal Engine 4 Beginner's Guide
Unreal Engine 4 Tutorials & How To's (With Pictures & Video)
Blender 3D Beginner's Guide
GIMP Beginner's Guide

About Edvog.com - Courses, How To's, Tutorials, Articles & Resources - Games, Music, Videos, Education, Information, Health, Medicine & Research

My name is Andrei Ionita, I am the creator and owner of edvog.com website, I am also the creator and owner of all of the products associated with it, such as: games, music, videos and more... I like to write articles about everything I find interesting in this world, most of the time I write educational articles, but you may also find articles without a main topic. The entire content found on this website is fact checked and original, when I post something, I try to double check all the information provided against all the reliable and trustworthy sources that I can find. On this website you may find content about medicine, the purpose of this type of content is simply informational and is not intended to be a substitute for professional medical advice, for questions you may have regarding your health, always seek the guidance of your doctor or other qualified health professional.

About entertainment and media - Beside, being a website owner and content writer, I'm also a game developer, music producer and video creator. I create, video games, music, animations, photos and more, this is why, from time to time, I will also post content about entertainment and media industry (a broad terminology, just to cover everything in the category). If you like platformer or runner games, you can check out the games made by me on Steam and on Google Play. If you like Relaxing, Ambient, Chill-out, Lounge, Electronic or Trap music you can check out my Youtube channel, Spotify profile, iTunes profile, Google Play Music profile, etc. Who knows? Maybe your next favorite game or song will be created by me :) If you want to support my work, you can play the games created by me, listen to my music and/or Make A PayPal Donation, whatever form of support you will choose, I thank you and wish you a nice day!

Edvog.com / Andrei Ionita on the internet

YoutubeGoogle PlaySteamAI Edvog on SpotifyAI Edvog on Google Play MusicAI Edvog on iTunesAI Edvog on SoundCloudSupport My Work Make A PayPal Donation

Comments