Тёмный

How to make a finish line in Unity 2D/3D 2021 

Hackingtons Code School
Подписаться 8 тыс.
Просмотров 26 тыс.
50% 1

We show you how to make a finish line for your game in Unity. This will work for both 2D and 3D games.
Check out Hackingtons: www.hackington...
Buy Some Merch: teespring.com/...

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

 

1 окт 2024

Поделиться:

Ссылка:

Скачать:

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

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 50   
@dawws0n581
@dawws0n581 2 года назад
Assets\FinishLine.cs(9,23): error CS1061: 'Collision2D' does not contain a definition for 'tag' and no accessible extension method 'tag' accepting a first argument of type 'Collision2D' could be found (are you missing a using directive or an assembly reference?) ???
@manudles
@manudles Год назад
SAME PROBLEM
@MuhammadAftabAhmed-uv8je
@MuhammadAftabAhmed-uv8je 16 дней назад
Better than this script using UnityEngine; using UnityEngine.SceneManagement; public class FinishFlag : MonoBehaviour { [Tooltip("Tag of the object that triggers the finish line.")] public string PlayerTag = "Player"; // You can set this to any tag in the Inspector [Tooltip("Name of the scene to load when the player reaches the finish line.")] public string SceneName; private bool levelCompleted = false; // To prevent multiple triggers private void OnTriggerEnter2D(Collider2D other) { // Check if the colliding object has the specified tag and level is not already completed if (other.CompareTag(PlayerTag) && !levelCompleted) { levelCompleted = true; CompleteLevel(); } } private void CompleteLevel() { // Load the next scene if (!string.IsNullOrEmpty(SceneName)) { SceneManager.LoadScene(SceneName); } else { Debug.LogError("Next scene name is not set!"); } } }
@triggerfinger5116
@triggerfinger5116 3 года назад
Hackingtons games are strange i like the youtuber Dani's games better
@hackingtons
@hackingtons 3 года назад
You should enroll in Hackingtons, that’s where the good stuff is. We don’t give away the good stuff for free.
@triggerfinger5116
@triggerfinger5116 3 года назад
@@hackingtons Ik i was in hackingtons but i got bored cuz unity and python blackbelt were the only things i could do
@pandascopz9104
@pandascopz9104 2 года назад
Your explanation of how the code works with unity is amazing, it is by far the best explanation I've gotten so far. Thank You!
@ARJUNPRO7154
@ARJUNPRO7154 5 месяцев назад
OMG THX!🤩🤩🤩
@drguineapig8755
@drguineapig8755 5 месяцев назад
I got like 13 errors Edit: fixed 12 of them The error is on line 9 and it says identifier expected.
@drguineapig8755
@drguineapig8755 5 месяцев назад
I’m doing this in 3D btw
@Five_Buiscuts
@Five_Buiscuts 2 года назад
iv finnished the script and it says tyhere is no errors and iv also done everything else but when i colide with my finnishing line nothing happens any ideas?
@BW-wd5dc
@BW-wd5dc 2 года назад
great video!! I was wondering, what does the code need to say if I just want to start the same level over again? I am developing a one-level game for my uni project :)
@BW-wd5dc
@BW-wd5dc 2 года назад
Nevermind - worked it out! I just left off the +1 after the buildIndex - thanks for posting this easy to follow video!
@FreakSheepVODS
@FreakSheepVODS 2 года назад
when i use this its say the level doesnt exits what doesnt make any sense SceneManager.LoadScene(WinScreen); Assets\Scenes\Scripts\FinishLine.cs(13,31): error CS0103: The name 'WinScreen' does not exist in the current context
@potato_2344
@potato_2344 5 месяцев назад
using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.SceneManagement; public class finish : MonoBehaviour { void OnTriggerEnter2D (Collider2D myCollider2D) { if (myCollider2D.tag == ("Player")) { SceneManager.LoadScene("Menu"); } } } Рабочий код перехода в другую сцену при касании финиша.
@panki6928
@panki6928 3 месяца назад
Отдуши друг
@guyingame3072
@guyingame3072 Год назад
hi do you know a tutuorial that will explain how to add levels to my 2d game?
@noicthebrave
@noicthebrave Год назад
Project Joyride Thanks You!!!
@brucewayne9434
@brucewayne9434 2 года назад
So helpful
@Mr-MS-Dev
@Mr-MS-Dev 2 года назад
this was helpful
@emilian_spielt300
@emilian_spielt300 Год назад
OMG THANK YOUUUUUUU!!!!! i searched HOURS to find a working tutorial, but yours is quite perfect! straith forward. thanks!
@joshua5838
@joshua5838 2 года назад
How do i put the buildIndex instead of increasing it so i can specify the scene/build that i want it to go to?
@DGBJamalYT
@DGBJamalYT 3 года назад
Hello I am making a game and thanks for the help
@spencerworkman
@spencerworkman 2 года назад
0:04 I think you forgot to show us how to adjust for 3D
@bunnygodx
@bunnygodx 9 месяцев назад
very great tutorial!! i subd
@bennisa8102
@bennisa8102 2 года назад
Could it just be an empty game object?
@russian__lizard645
@russian__lizard645 2 года назад
Well when I get home I hop this works
@rafaelrodrigues3234
@rafaelrodrigues3234 Год назад
Thanks a lot!!! After 4 hours i manage to do it
@Ufus.
@Ufus. Год назад
Thanks a lot. Thats what ım looking for . after years this kind of videos still helps us to learn .
@panagiotiskotsias4496
@panagiotiskotsias4496 2 года назад
Hey man i use a custom Player movement script with it's own collision, and I changed OnTriggerEnter2D to OnCollisionEnter2D. The problem is that there is an error in the line collision.tag == "Player" the ".tag" highlights as wrong for me please help thanks :)
@hackingtons
@hackingtons 2 года назад
You will have to use CompareTag(“Player”). There’s more details in the docs if you Google that
@panagiotiskotsias4496
@panagiotiskotsias4496 2 года назад
@@hackingtons fixed it but thanks :)
@at930pmgames
@at930pmgames 3 года назад
In a very basic way its good for single player.
@oliver32321
@oliver32321 Год назад
tysm :)))
@HMYT-jw5to
@HMYT-jw5to 2 года назад
im using a player controller script that has makes its on collider when put on the player so if someone can tell me how to can do the same thing with the scripts collider
@hackingtons
@hackingtons 2 года назад
Its the exact same code just use OnCollisionEnter instead of OnTriggerEnter
@HMYT-jw5to
@HMYT-jw5to 2 года назад
@@hackingtons thank you
@kareem5340
@kareem5340 3 года назад
Thank you so much ❤️❤️❤️❤️
@axcilium
@axcilium 3 года назад
Thanks
@jadongames777
@jadongames777 2 года назад
For some reason it will not work for my 3d game. Can someone please tell me why?
@hackingtons
@hackingtons 2 года назад
If you are using OnTriggerEnter2D there are no 2D components in a 3D game. Try using OnTriggerEnter instead
@jadongames777
@jadongames777 2 года назад
@@hackingtons thanks it worked
@deticek6339
@deticek6339 2 года назад
thanks dude i finaly find after 2h what i need
@hackingtons
@hackingtons 2 года назад
No problem 👍
@100funtNAGIBATOR
@100funtNAGIBATOR 2 года назад
спасибо большое
@avaobrien7222
@avaobrien7222 3 года назад
OMG THANK YOU!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! I GET TRIGGERS NOW!!!!!
@fabianlo234
@fabianlo234 10 месяцев назад
Thanks! Great tutorial! Keep it up bro! You're funny too.👍
@Hyjk87
@Hyjk87 2 года назад
Thanks a lot Dude! Super clear, love it.
@franciscospinola7883
@franciscospinola7883 2 года назад
Ty, you helped me a lot. Btw you have a very nice accent, it's awesome you are not an Indian guy!
@manudles
@manudles Год назад
wtf that is so racist
Далее
Game Over Screen Unity Tutorial
14:35
Просмотров 44 тыс.
Creating Rope Objects with Physics | Unity Tutorial
10:36
荧光棒的最佳玩法UP+#short #angel #clown
00:18
THIRD PERSON MOVEMENT in Unity
21:05
Просмотров 1,4 млн
How to Make A Randomly Walking A.I. in Unity
11:11
Просмотров 20 тыс.
How to jump in Unity (with or without physics)
16:09
Просмотров 45 тыс.
I Oversimplified Famous Games
12:41
Просмотров 14 тыс.
PAUSE MENU in Unity
12:13
Просмотров 988 тыс.
The Unity Tutorial For Complete Beginners
46:39
Просмотров 3,6 млн