Загрузка...

How to Build a Simple and Functional Main Menu System in Unity 6 using C#.

In this video, I’ll show you how to build a simple and functional main menu system in Unity using C#.
You’ll learn how to switch between scenes and safely exit the game with a confirmation dialogue.

We cover:

* Loading multiple scenes using `SceneManager.LoadSceneAsync`
* Creating menu buttons for different game levels
* Adding an **exit confirmation dialog** that works in the Unity Editor
* Properly quitting the game in a built application

This tutorial is perfect for **Unity beginners** and anyone building a basic game menu system.

💻 **Tools used:**
Unity Engine • C# • Scene Management

If you found this helpful, don’t forget to **like, subscribe, and share** for more Unity tutorials!

#Unity #GameDevelopment #CSharp #UnityTutorial #IndieGame #SceneManagement

Join this channel to get access to codes, perks, and see more interesting videos. https://www.youtube.com/channel/UCFtw9CfTfMKU9aHZsT2teYg/join

I was hoping you could buy me a coffee: https://www.paypal.me/POamen

To support more videos from DJ Oamen, visit POamen Paypal
https://www.paypal.me/POamen

To become a Channel member, click on the link below to JOIN:
https://www.youtube.com/channel/UCFtw9CfTfMKU9aHZsT2teYg/join

For more exciting video tutorials, visit my second channel: https://www.youtube.com/c/PaulOamen/videos

Download the code: https://drive.google.com/file/d/1fqtUKs8PJ_NlI4WQHkNJ8oaNg23Q7Qfq/view?usp=sharing
See code below:

using UnityEngine;
using UnityEngine.SceneManagement;

public class MenuGames : MonoBehaviour
{
public void FrontMenu()
{
SceneManager.LoadSceneAsync(0);
}
public void GameOne()
{
SceneManager.LoadSceneAsync(1);
}

public void GameTwo()
{
SceneManager.LoadSceneAsync(2);
}

public void ExitGame()
{
#if UNITY_EDITOR
bool confirm = UnityEditor.EditorUtility.DisplayDialog("Confirm Exit",
"Are you sure you want to exit?", "Yes", "No");

if (confirm)
{
UnityEditor.EditorApplication.isPlaying = false;
}
#else
Application.Quit();
#endif
}
}

Видео How to Build a Simple and Functional Main Menu System in Unity 6 using C#. канала DJ Oamen
Яндекс.Метрика
Все заметки Новая заметка Страницу в заметки
Страницу в закладки Мои закладки
На информационно-развлекательном портале SALDA.WS применяются cookie-файлы. Нажимая кнопку Принять, вы подтверждаете свое согласие на их использование.
О CookiesНапомнить позжеПринять