Тёмный

How to Change Scenes in Unity Using C# (Unity Tutorial 2021) 

Omogonix
Подписаться 9 тыс.
Просмотров 35 тыс.
50% 1

In this Unity tutorial, I show you all how to change scenes in Unity using C#.
Script:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class nextscene : MonoBehaviour
{
public string scenename;
void OnTriggerEnter(Collider other){
if(other.CompareTag("Player")){
SceneManager.LoadScene(scenename);
}
}
}
Follow me on Twitter:
/ omogonix
Forgehub:
www.forgehub.c...
Subscribe to my Second Channel:
/ @lachlanshelton129
Join my Discord:
/ discord
Facebook Page:
/ omogonix
Follow me on Instagram:
/ uwugonixhalo
Itch.io:
omogonixlachla...
Music Used:
-Ship Wrek & Zookeepers - Ark (NCS Release):
• Ship Wrek & Zookeepers...

Игры

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

 

7 сен 2024

Поделиться:

Ссылка:

Скачать:

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

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 60   
@federicovolpi3195
@federicovolpi3195 6 месяцев назад
I was starting to loose hope in using scripts as every one I tried so far using tutorial didn't work... I started having error and not being able to test the game until the problem is solved (wich I have no idea what it is). After trying this and making an error I was able to double check and make it work!!! I can't believe is the first script that I manage to use!!!! I can't thank you enough!!
@crazyplaystationmonkey7598
@crazyplaystationmonkey7598 Год назад
I found this script to be very helpful for my class final, Thank you very much for sharing it! (=
@_uriah_
@_uriah_ 22 дня назад
For your player, make sure to tag the capsule(The child of the player) and not the parent game object. Don't tag the player, tag the capsule, because the capsule has a collider and the parent object(Player) does not have a collider. This depends on what movement setup you are using. I hope this helps some of you.
@chichimurucho5322
@chichimurucho5322 День назад
Real hero
@_uriah_
@_uriah_ День назад
@@chichimurucho5322 Thanks man (:
@skybone7
@skybone7 Год назад
Thank you so much. It's help me to make prototype of my project. Respect, carma +10 to you.
@johncontreras62
@johncontreras62 3 месяца назад
I know I am very late to this but I had a question. It works perfectly fine and was able to make it so the player enters a house it goes into a new scene and when they leave they go back into the original scene. But it positions the player back towards where the game starts. Is there a way to put the player position into a certain area (specifically back in front of the house)?
@TheLittleFastCat
@TheLittleFastCat Месяц назад
Thanks I am working on a space horror game and this greatly helped
@BurglarFromTheYouTube
@BurglarFromTheYouTube День назад
thansk for useful script
@aliking019
@aliking019 28 дней назад
Thanks you very good.❤❤❤
@cainscot
@cainscot 6 дней назад
tysm!!!!! now thats gonna be a sub :D
@brucewayne9434
@brucewayne9434 2 года назад
worked like a charm!
@FotiniKal
@FotiniKal 4 месяца назад
hi! when i'm chainging scenes there is no good lighting in the incoming scene... Ι dont know the way to change it
@batacube2995
@batacube2995 2 месяца назад
Thank you! I created cheakpoint!
@Frsz1411
@Frsz1411 Год назад
It works now thanks man.
@CorrinCranson
@CorrinCranson Год назад
yes it help so much thank you
@fishrim
@fishrim 4 месяца назад
thank you very ez to use and great
@andyawesome8617
@andyawesome8617 Год назад
Thanks this was supper good :)
@RanonPlay
@RanonPlay 5 месяцев назад
Thanks very much
@theacedragon5800
@theacedragon5800 8 месяцев назад
You just have to add 2D after OntriggerEnter and Collider and it works in 2D
@williamswim2240
@williamswim2240 Год назад
thank you dude!!!!!
@RRA42069
@RRA42069 8 месяцев назад
love the wallpaper
@user-zb1sv1vf8u
@user-zb1sv1vf8u Год назад
Check is trigger in box collider guys!
@im_so_bored_rn
@im_so_bored_rn 27 дней назад
omg thank you so much
@talismanskulls2857
@talismanskulls2857 11 месяцев назад
Cant get this to work properly with my persistent UI that loads a player prefab clone.
@j4rka131
@j4rka131 7 месяцев назад
Nice code it works
@David64580
@David64580 7 месяцев назад
thx bro
@Isteyak-78
@Isteyak-78 7 месяцев назад
thanks
@Rage_Edits66
@Rage_Edits66 Год назад
thanks I love u
@PillowMonkeyVR
@PillowMonkeyVR 8 месяцев назад
it worked like a charm but it won't let me do multiple in one scene
@keolotso
@keolotso Год назад
idk why but does not work for me sadly
@keolotso
@keolotso Год назад
works now fixed the compare tag because i used an other tag Thx
@FearunLT
@FearunLT Год назад
@@keolotso whats compare tag?
@pjo-fan
@pjo-fan 5 месяцев назад
thx
@Heimdall12345
@Heimdall12345 2 года назад
In next scene My player will continue with copied player?
@Omogonix
@Omogonix 2 года назад
When you change scenes, your game should continue with the player in that scene yes
@Heimdall12345
@Heimdall12345 2 года назад
@@Omogonix Okay bro thank you
@Shutupbanana
@Shutupbanana 2 года назад
How to set the camera in the player if I walk the player walks out the cam
@Omogonix
@Omogonix 2 года назад
You need to make the camera a child of the player. Make sure you watch the video so you know what you're doing haha
@Shutupbanana
@Shutupbanana 2 года назад
@@Omogonix i watch the video and you sett the camera in it
@NAGYT101
@NAGYT101 Год назад
how to make it for vr
@safwanadil692
@safwanadil692 Год назад
doesnt work for me can anyone help??
@Not3Joshua
@Not3Joshua Год назад
How do you copy the stuff on the left side?
@GameMakerGuy
@GameMakerGuy 9 месяцев назад
You highlight it, then right click and select copy, then where you want to paste it, right click and select paste
@atharvasarfare5340
@atharvasarfare5340 11 месяцев назад
This will only work if the game is single player i.e. networking is not involved
@VRMonkeyz
@VRMonkeyz 7 месяцев назад
Oh
@Shutupbanana
@Shutupbanana 2 года назад
How to copy it
@fictitiousnightmares
@fictitiousnightmares 4 месяца назад
What's the point of talking at the start and then making us read the rest of the entire video?
@humamoyous
@humamoyous 3 месяца назад
Fr
@BonesOfficial_
@BonesOfficial_ 3 месяца назад
Y’all guys are scared of basic elementary words 💀
@fictitiousnightmares
@fictitiousnightmares 3 месяца назад
@@BonesOfficial_ Come on over to my house for dinner. *you get here" Here's the ingredients..... What's wrong, you scared of basic ingredients?
@BonesOfficial_
@BonesOfficial_ Месяц назад
@@fictitiousnightmaresthat was a old comment when I was younger. I forgot it existed 💀
@therealeditorpotato9684
@therealeditorpotato9684 28 дней назад
“When I was younger” bro that was 2 months ago your still young
@snowballvr6561
@snowballvr6561 2 года назад
it gives a error
@BonesOfficial_
@BonesOfficial_ 8 месяцев назад
Приьет btw I’m new
@M-Silver0823
@M-Silver0823 Год назад
i have a problem can you help me
@interzy4807
@interzy4807 2 года назад
for some resoan it doesnt work for me
@interzy4807
@interzy4807 2 года назад
it works
@Omogonix
@Omogonix 2 года назад
That's good to hear! I just saw this now lol
@th8t_guy_dz
@th8t_guy_dz Месяц назад
great vid
Далее
How to Fade Between Scenes in Unity
13:28
Просмотров 343 тыс.
Butch REACT to Creative way to fix damaged tile!
00:46
Bike vs Super Bike Fast Challenge
00:30
Просмотров 4,4 млн
I Optimised My Game Engine Up To 12000 FPS
11:58
Просмотров 658 тыс.
20 Advanced Coding Tips For Big Unity Projects
22:23
Просмотров 181 тыс.
Unity - How to Use a Button To Switch Between Scenes
4:21
Exporting Unity Scenes as Video
8:33
Просмотров 70 тыс.
МЕНЯ СМЫЛИ В УНИТАЗ в ROBLOX!
21:38
Просмотров 23 тыс.
ДВЕРЬ УЖАСОВ 2 *ЮДЖИН и ПОЗЗИ*
24:57