Level Selection Menu with Stars & Level Unlocking | Unity Beginner Tutorial

Поделиться
HTML-код
  • Опубликовано: 22 май 2024
  • Level Selection Menus are an extremely part of most games, allowing user to choose what the want to play in your game
    In this Unity tutorial we'll make a complete level selection menu, with all the required code for starting levels, unlocking levels and giving stars to levels.
    Cartoon Game UI Pack Asset used in this tutorial:
    assetstore.unity.com/packages...

Комментарии • 6

  • @JackallDigital
    @JackallDigital 6 месяцев назад

    Thank you for the video, it was of great help to me. I had to make some changes for my game but the scroll view was the best thing I learned how to use, now I can make as many levels as I want!

  • @mikhailhumphries
    @mikhailhumphries 6 месяцев назад

    Keep up good work

  • @SSSova796
    @SSSova796 4 месяца назад +1

    Of course, I had to make small changes to the code, but thanks a lot anyway.

  • @lucastavares06
    @lucastavares06 Месяц назад

    download pls

  • @kokosonev6675
    @kokosonev6675 5 месяцев назад +1

    its not working, when you click on the first level and complete it you are not unlocking the next the interactable stays false

    • @LonelyGamingStudio
      @LonelyGamingStudio 28 дней назад +1

      Fixed it :)
      using System.Collections;
      using System.Collections.Generic;
      using UnityEngine;
      using UnityEngine.SceneManagement;
      public class LevelSelectMenu : MonoBehaviour
      {
      public LevelObject[] levelObjects;
      public static int currLevel;
      public static int UnlockedLevels;
      public void OnClickLevel(int levelNum)
      {
      currLevel = levelNum;
      SceneManager.LoadScene("GameScene");
      }
      public void OnClickBack()
      {
      this.gameObject.SetActive(false);
      }
      // Start is called before the first frame update
      void Start()
      {
      UnlockedLevels = PlayerPrefs.GetInt("UnlockedLevels", 1); // Pierwszy poziom odblokowany na starcie
      for (int i = 0; i < levelObjects.Length; i++)
      {
      if (UnlockedLevels > i)
      {
      levelObjects[i].levelButton.interactable = true;
      }
      }
      }
      }
      using System.Collections;
      using System.Collections.Generic;
      using UnityEngine;
      using UnityEngine.SceneManagement;
      public class LevelComplete : MonoBehaviour
      {
      public void OnLevelComplete()
      {
      if (LevelSelectMenu.currLevel == LevelSelectMenu.UnlockedLevels)
      {
      LevelSelectMenu.UnlockedLevels++;
      PlayerPrefs.SetInt("UnlockedLevels", LevelSelectMenu.UnlockedLevels);
      }
      SceneManager.LoadScene("MainMenu");
      }
      }