Тёмный

Unity - Creating a Level Select Screen in C# 

Press Start
Подписаться 24 тыс.
Просмотров 36 тыс.
50% 1

In this video I am going to show you how to create a level manager using only C# code.
SUBSCRIBE: bit.ly/2Js78lE
============
SUPPORT: / pressstartclub
In this video, we cover:
0:30 - Setting up the scene
0:55 - Creating a Level Button prefab
1:25 - Creating a Placeholder Panel for our Pages
2:02 - Creating a C# script to manage our levels
2:40 - Calculating how many levels fit on a page and how many total pages we need to create
4:30 - Creating a function to create a panel for each page
5:55 - Cloning our panel placeholder
8:00 - Creating a function to clone and place our level icons
9:35 - Creating a Grid Layout Group with C# code
10:15 - Adding Cell Size and alignment to our Grid Layout Group
12:15 - Adding the Page Swiper script
12:45 - Customizing Level Icons to show Level Number
13:20 - Adding Cell Spacing to our Grid Layout Group
14:15 - Adjusting the Page Swiper script to max out pages
15:40 - Final Product
PAGE SWIPER VIDEO:
• Swiping Pages in Unity
IF YOU FOUND ANY VALUE FROM THIS VIDEO CONSIDER JOINING OUR PATREON CLUB:
/ pressstartclub
COPY & PASTE CODE FROM THIS TUTORIAL:
pressstart.vip/tutorials/2019...
MORE TUTORIALS:
pressstart.vip/unity-tutorials

Опубликовано:

 

5 июл 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 85   
@Chapali9a
@Chapali9a 4 года назад
Wow! Fantastic stuff. Even though I didn't understand everything in this lesson but I still learnt new stuff. I really appreciate the amount of energy you put into making these. Absolutely phenomenal. Thank you
@sakisgrig
@sakisgrig 5 лет назад
Your two (relating) videos were excactly what I needed to create my scroller. I am very grateful :)
@pressstart6864
@pressstart6864 5 лет назад
Love this feedback. Thank you!
@mrsypo02
@mrsypo02 4 года назад
this is the most clean unity tuto i ever seen god. job brother !!!
@sathishvasudev1752
@sathishvasudev1752 3 года назад
Hey bro, Your video was very helpful for me. I had some issues though but got that figured out. Keep up the good work, mate!
@alinazari2046
@alinazari2046 4 года назад
Your tutorials are amazingly awesome, keep on :)
@MrWaaaaah
@MrWaaaaah 3 года назад
Great tuts. As a beginner myself, I get a good understanding as you explain straight to the point. Your speed helps too; vids that go too slow waste alot of time.. LOL. Subscribed *thumbsup*
@arcangy77
@arcangy77 4 года назад
awesome!! I love this kind of tutorial!! fast and very useful!! great job ^^
@pressstart6864
@pressstart6864 4 года назад
Cheers my dude
@teu2387
@teu2387 3 года назад
ur soo underrated, good job u earned a sub man
@svenwierenga2575
@svenwierenga2575 4 года назад
Never sad anything! Thanks for the great video!!!
@ufukhan6696
@ufukhan6696 5 лет назад
You're the BEST ❤❤
@pressstart6864
@pressstart6864 5 лет назад
Thank you!
@lominero5
@lominero5 Год назад
Great video super easy to understand
@oliverphilbrick2986
@oliverphilbrick2986 3 года назад
Came here to see an effective way to make the buttons actually load levels. Perhaps make a part 2? as it stands now, a strong tutorial for laying out a bunch of buttons, but not very useful if you don't demonstrate how to actually wire them to functions.
@emilis3779
@emilis3779 5 лет назад
You video is very entertainment. I love how you explain every thing from the video. Keep up the good work :)
@pressstart6864
@pressstart6864 5 лет назад
Thank you, this video was a hard one to explain ;)
@cocagamingvideo
@cocagamingvideo 4 года назад
Amazing tutorial ! I was wondering if it was possible to use a button in order to swipe to a certain page; like an Option button that when you press it, it swipes directly to a certain panel (currentPage)? Thank you so much for your great tutorials :D
@suikasuika4157
@suikasuika4157 3 года назад
i wish you did more tuto i like the way you make them
@gamemaster_tv
@gamemaster_tv 4 года назад
Please, someone smart: How can I make Main Camera swipe along the UI buttons?
@ConcreteJungleGames
@ConcreteJungleGames 4 года назад
@Press Start Is there a way to press a button and have the screen swipe in the same way?
@bisharakhuri2504
@bisharakhuri2504 4 года назад
5:50 a reminder for me :D
@thebluefox651
@thebluefox651 3 года назад
It thought at first that it would take me a long time and than it would'nt work and than I'll try it again and it would'nt work again, But you explain it well and easy to know what you say, you dont type so fast or so slow, it took me long but it worked! Thank you SO SO MUCH
@Zap.zz.
@Zap.zz. 2 года назад
JUST WOW
@Zap.zz.
@Zap.zz. 2 года назад
Great Tutorial😁
@jezuinnit2570
@jezuinnit2570 2 года назад
Yo Waldo I tried this and I used the source code and I applied the grid layout group but i get an error that says "NullReferenceException: Object reference not set to an instance of an object LevelSelector.SetUpGrid (UnityEngine.GameObject panel) (at Assets/ScriptsLevelSelector.cs:47)" please help
@chrisshanaz
@chrisshanaz 4 года назад
Thanks for the great tutorial , how can i make it that each level icon goes to a different scene. Thanks!
@josechowyi
@josechowyi 4 года назад
having the same problem
@djdee04
@djdee04 2 года назад
@Bendegúz Anisics hey, if u don’t mind can you show us how lock levels and unlock them as we progress . thank yo
@bene5776
@bene5776 4 года назад
I‘ve got a problem! With any new Panel/Page i is reset to 1. So I‘ve got 40 Levels on 2 pages: on the 1. Page are levels 1-20 and on the 2. page should be levels 21-40 but there are also the levels 1-20 because i is reset to 1... Do you have any solution for that? Thanks for the tutorial and your reply.
@pressstart6864
@pressstart6864 4 года назад
If you use the code in the video, it should solve your problem. At 15:40 the numbers increment for each page.
@EgeDai
@EgeDai 4 года назад
man you had so much room in your sound I thought my speakers were on with open ear headphones :D
@rainbowtomat0803
@rainbowtomat0803 4 года назад
How dit you get the trophy icon
@cfpwastaken
@cfpwastaken 4 года назад
The Button is not showing in Game and i need to make them very small because when i create one of thoose buttons they are displayed SOOOOO HUGE!
@__Hay_Dar__
@__Hay_Dar__ 3 года назад
on start panel should scroll to the last unlocked level ... it would be great if you make a video for this scenario
@computercrafty9090
@computercrafty9090 3 года назад
I have an error. After displaying the no. of icons specified, it displays all the other icons down. Does anyone have a fix please. If yes then reply as fast as you can. Thanks in Advance
@IheartGames646
@IheartGames646 2 года назад
so how do you go to the next level when pressing a button
@rainbowtomat0803
@rainbowtomat0803 4 года назад
How do jou make the clone 06:40
@uhrgmreghagemge7419
@uhrgmreghagemge7419 5 лет назад
Hello, I'm not sure why It doesn't work for me. I copy pasted the code, created everything like you did even the button size, image size. The problem seems to be that the script doesn't take into account the image dimension , only the button When I print the iconDimensions = levelIcon.GetComponent().rect; It prints the button dimension and not the image, you said that the script will caculate the dimension based on the icon am I missing something ? Thanks for your help That is how it looks like : imgur.com/a/X2C5yip
@hollowbloop3662
@hollowbloop3662 4 года назад
"panel.transform.SetParent(thisCanvas.transform,false);" is the line thats casuing your issues. Unfortunately do not know how to fix it
@hollowbloop3662
@hollowbloop3662 4 года назад
Do not make the 'levelHolder' GameObject use a prefab but rather let it be the normal gameObject from the Scene. This fixed the problem for me. Hope this helps.
@TheTylerBlair
@TheTylerBlair 4 года назад
Check to see if you scaled the Icon prefab. Change the width and height attributes and reset the x and y scale back to 1.
@ei05056
@ei05056 3 года назад
I don't get it, you had already added the GridLayoutGroup to the Panel in the Unity Editor, why do you need to do it again in the code?
@justl7153
@justl7153 3 года назад
I have had same question, don't add it and everything will work fine.
@ei05056
@ei05056 3 года назад
@@justl7153 Yup, that's what I did.
@bkkaan52
@bkkaan52 2 года назад
why my all levels are appearing on the same page and creating only one panel?
@danieljayne8623
@danieljayne8623 3 года назад
The last video was posted 10 months ago. Where's Waldo? :(
@TomerGamerTV
@TomerGamerTV 2 года назад
and how do I make it clickable?
@krishshah8306
@krishshah8306 5 лет назад
How could you make it so that each icon, when clicked, would go to its associated level because you cannot add a script to a game object that doesn't exist until you start it.
@pressstart6864
@pressstart6864 5 лет назад
You can add a script to the icon before you make it a prefab or you can use addcomponent to add it during runtime.
@TheGeneliia
@TheGeneliia 4 года назад
@@pressstart6864 I wrote this code but it always go to last scene. in for : icon.GetComponent().onClick.AddListener(delegate { goToLevel(i); }); other code: private void goToLevel(int sceneNumber) { SceneManager.LoadScene(sceneNumber); Debug.Log(sceneNumber); }
@TheGeneliia
@TheGeneliia 4 года назад
@@pressstart6864 private void goToLevel(int sceneNumber) { SceneManager.LoadScene(sceneNumber); Debug.Log(sceneNumber); }
@aferg8587
@aferg8587 4 года назад
Ahmet Bilal ÇELİK Hey I figured it out if u need help
@daw5835
@daw5835 4 года назад
@@aferg8587 can you help me?
@lcd11001
@lcd11001 4 года назад
14:13 is the fixed
@hypersolfi7988
@hypersolfi7988 3 года назад
when my buttons come in they go over the top and underneath the screen
@AdrianuLL
@AdrianuLL 3 года назад
I have only one question... what do I have to do so when I press on the level button it takes me to another scene??????????
@punchspelledbackwards
@punchspelledbackwards 3 года назад
using UnityEngine; using UnityEngine.SceneManagement; public class Script : MonoBehaviour { void SelectLevel(string scene) { SceneManager.LoadScene(scene); } } you can also load scenes by making a string variable then just loading it, like so: using UnityEngine; using UnityEngine.SceneManagement; public class Script : MonoBehaviour { public string levelToLoad; void SelectLevel(string scene) { SceneManager.LoadScene(levelToLoad); } } or you could do it with build indexes: using UnityEngine; using UnityEngine.SceneManagement; public class Script : MonoBehaviour { void SelectLevel() { SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex + 1); } } this is for if you want to load the next scene bte ^^
@djdee04
@djdee04 2 года назад
@@punchspelledbackwards hey can you show, how to lock levels and unlock them as we progress. Thank you
@punchspelledbackwards
@punchspelledbackwards 2 года назад
@@djdee04 ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-AQpDtrNJAEU.html
@szymonjarosz9627
@szymonjarosz9627 4 года назад
Hey can you please help me im trying to use the firsts part of this tutorial to create image slide so i dont need all of the management of the screens i just want the user to have a max out pages your input would be amazing
@szymonjarosz9627
@szymonjarosz9627 4 года назад
Lol worked it out
@thisalrathnayake9460
@thisalrathnayake9460 3 года назад
@@szymonjarosz9627 hold im having the same problem, what was the fix?
@DJKi2463
@DJKi2463 4 года назад
4:57
@chinyereajala9886
@chinyereajala9886 3 года назад
I've implemented a way to load the scenes but how do I lock them, to play a scene after finishing the last kind of system. Whatever I try just locks everything up😅.
@djdee04
@djdee04 2 года назад
@chinyere, if you don’t mind can you share the codes to launch the level??
@sifsif2725
@sifsif2725 3 года назад
What about the o'clock event? I want the levels to take me to.. well specific levels how do I add that?
@NonHuman69
@NonHuman69 3 года назад
i have a question i get this error do you now how i can fix this Object reference not set to an instance of an object and i get this as a messege Can't add 'GridLayoutGroup' to Page-1 because a 'GridLayoutGroup' is already added to the game object! A GameObject can only contain one 'LayoutGroup' component.
@computercrafty9090
@computercrafty9090 3 года назад
remove the grid layout group from the panel(the same panel that has the level buttons). The code itself will add it so you dont had too. Had the same error tho. Welcome :)
@NajeksYoutube
@NajeksYoutube 4 года назад
Everything is good but I think you forgot about " how to make buttons working". How to attach an onClick function to them.
@aferg8587
@aferg8587 4 года назад
Did you figure it out? I cant figure out how to make each button take me to a unique scene
@Zombivoro
@Zombivoro 4 года назад
​@Bendegúz Anisics Thanks, without this comment the tutorial is pointless. Although, I don't think it's a great solution. The Level Selector script should had been made with this in mind so you don't need to get the level number from the button text number, which I would say it's a pretty bad practice.
@chinyereajala9886
@chinyereajala9886 3 года назад
@Bendegúz Anisics Hey any idea on how to lock and unlock the scenes as you play through the level
@littlegreen4899
@littlegreen4899 3 года назад
Oh come on I just changed from 2018vee
@sachinahuja3894
@sachinahuja3894 5 лет назад
plz help me to make cpu based player game like ludo player vs cpu
@advikmalwa379
@advikmalwa379 4 года назад
Thanku I really needed this 👇 Likes for this guy
@FratNightGaming
@FratNightGaming 4 года назад
this is not explained well for beginners. too fast
@bobbybotbop
@bobbybotbop 3 года назад
no ur just dumb im a beginner and i had to speed it up because of how smart i am
@tudypie
@tudypie 3 года назад
@@bobbybotbop why you have to be like that to him... he is just learning unity calm down man
@bobbybotbop
@bobbybotbop 3 года назад
@@tudypie YOU CALM DOWN IM PERFECTLY CALM UR THE ONE WHO NEEDS TO CALM DOWN SHUT THE FRIK UP NOBODY ASKED YOU TUDYPIE MORE LIKE TURDYPIE
@bobbybotbop
@bobbybotbop 3 года назад
@Tristan Basri no one asked you
@LeoKing0
@LeoKing0 4 года назад
your not explaining good enough for beginners especially the beginning
Далее
Swiping Pages in Unity
9:43
Просмотров 56 тыс.
Happy 4th of July 😂
00:12
Просмотров 5 млн
Unity - Point and Shoot Tutorial
9:28
Просмотров 82 тыс.
2D PATHFINDING - Enemy AI in Unity
23:13
Просмотров 804 тыс.
Welcome to Press Start
1:16
Просмотров 10 тыс.
Unity - Enemy Follows Player [Beginner Tutorial]
6:51
Просмотров 183 тыс.
SETTINGS MENU in Unity
17:22
Просмотров 930 тыс.