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

  Рет қаралды 30,756

Omogonix

Omogonix

3 жыл бұрын

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.com/members/omog...
Subscribe to my Second Channel:
/ @lachlanshelton129
Join my Discord:
/ discord
Facebook Page:
/ omogonix
Follow me on Instagram:
/ uwugonixhalo
Itch.io:
omogonixlachlan.itch.io
Music Used:
-Ship Wrek & Zookeepers - Ark (NCS Release):
• Ship Wrek & Zookeepers...

Пікірлер: 49
@crazyplaystationmonkey7598
@crazyplaystationmonkey7598 Жыл бұрын
I found this script to be very helpful for my class final, Thank you very much for sharing it! (=
@federicovolpi3195
@federicovolpi3195 4 ай бұрын
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!!
@brucewayne9434
@brucewayne9434 Жыл бұрын
worked like a charm!
@skybone7
@skybone7 Жыл бұрын
Thank you so much. It's help me to make prototype of my project. Respect, carma +10 to you.
@Frsz1411
@Frsz1411 Жыл бұрын
It works now thanks man.
@andyawesome8617
@andyawesome8617 Жыл бұрын
Thanks this was supper good :)
@CorrinCranson
@CorrinCranson Жыл бұрын
yes it help so much thank you
@fishrim
@fishrim Ай бұрын
thank you very ez to use and great
@williamswim2240
@williamswim2240 Жыл бұрын
thank you dude!!!!!
@batacube2995
@batacube2995 Күн бұрын
Thank you! I created cheakpoint!
@RanonPlay
@RanonPlay 3 ай бұрын
Thanks very much
@RRA42069
@RRA42069 5 ай бұрын
love the wallpaper
@johncontreras62
@johncontreras62 10 күн бұрын
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)?
@FotiniKal
@FotiniKal Ай бұрын
hi! when i'm chainging scenes there is no good lighting in the incoming scene... Ι dont know the way to change it
@j4rka131
@j4rka131 4 ай бұрын
Nice code it works
@benixbvr114
@benixbvr114 Жыл бұрын
thanks I love u
@David64580
@David64580 5 ай бұрын
thx bro
@talismanskulls2857
@talismanskulls2857 8 ай бұрын
Cant get this to work properly with my persistent UI that loads a player prefab clone.
@Isteyak-78
@Isteyak-78 4 ай бұрын
thanks
@user-zb1sv1vf8u
@user-zb1sv1vf8u 9 ай бұрын
Check is trigger in box collider guys!
@pjo-fan
@pjo-fan 2 ай бұрын
thx
@PillowMonkeyVR
@PillowMonkeyVR 5 ай бұрын
it worked like a charm but it won't let me do multiple in one scene
@NAGYT101
@NAGYT101 10 ай бұрын
how to make it for vr
@theacedragon5800
@theacedragon5800 5 ай бұрын
You just have to add 2D after OntriggerEnter and Collider and it works in 2D
@Not3Joshua
@Not3Joshua 11 ай бұрын
How do you copy the stuff on the left side?
@GameMakerGuy
@GameMakerGuy 6 ай бұрын
You highlight it, then right click and select copy, then where you want to paste it, right click and select paste
@safwanadil692
@safwanadil692 Жыл бұрын
doesnt work for me can anyone help??
@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
@Shutupbanana
@Shutupbanana 2 жыл бұрын
How to copy it
@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
@keolotso709
@keolotso709 11 ай бұрын
idk why but does not work for me sadly
@keolotso709
@keolotso709 11 ай бұрын
works now fixed the compare tag because i used an other tag Thx
@FearunLT
@FearunLT 11 ай бұрын
@@keolotso709 whats compare tag?
@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
@atharvasarfare5340
@atharvasarfare5340 8 ай бұрын
This will only work if the game is single player i.e. networking is not involved
@VRMonkeyz
@VRMonkeyz 4 ай бұрын
Oh
@snowballvr6561
@snowballvr6561 Жыл бұрын
it gives a error
@BonesOfficial_
@BonesOfficial_ 5 ай бұрын
Приьет btw I’m new
@fictitiousnightmares
@fictitiousnightmares Ай бұрын
What's the point of talking at the start and then making us read the rest of the entire video?
@humamoyous
@humamoyous 23 күн бұрын
Fr
@BonesOfficial_
@BonesOfficial_ 17 күн бұрын
Y’all guys are scared of basic elementary words 💀
@fictitiousnightmares
@fictitiousnightmares 17 күн бұрын
@@BonesOfficial_ Come on over to my house for dinner. *you get here" Here's the ingredients..... What's wrong, you scared of basic ingredients?
I Made the Same Game in 8 Engines
12:34
Emeral
Рет қаралды 3,8 МЛН
Чай будешь? #чайбудешь
00:14
ПАРОДИИ НА ИЗВЕСТНЫЕ ТРЕКИ
Рет қаралды 2,8 МЛН
Учим Unity за 1 час! #От Профессионала
1:59:24
Хауди Хо™ - Просто о мире IT!
Рет қаралды 1,6 МЛН
$10,000 Every Day You Survive In The Wilderness
26:44
MrBeast
Рет қаралды 127 МЛН
Unity - How to Use a Button To Switch Between Scenes
4:21
How much MONEY my Game made (and how much it cost!)
14:00
Code Monkey
Рет қаралды 156 М.
How to Switch Levels with Trigger Area for 2D RPGs in Unity
5:07
Chris' Tutorials
Рет қаралды 41 М.
$10,000 Every Day You Survive Prison
13:59
MrBeast
Рет қаралды 213 МЛН
How to make AWESOME Scene Transitions in Unity!
19:45
Brackeys
Рет қаралды 917 М.
Build a beautiful 3D open world in 5 minutes | Unity
5:57
spaderdabomb
Рет қаралды 318 М.
skibidi toilet multiverse 038
6:38
DOM Studio
Рет қаралды 7 МЛН