#jacol ima create a thread so its easier
1 messages · Page 1 of 1 (latest)
alright
okay perf
so what scene are you currently in? you can see by the very top item in your hierarchy?
dcont worry thats fine
its called sample screen
do you know where that scene is located in your assets?
yes
and its a file not an object in the hierarchy
in my scenes folder
yeah
now that is bassically a file that contains everything in your heirarchy
tell me if you understand all of this and ill speed it up
yeah i understand for now
i just wanna make sure you understand exactly what scenes are first
now i understand
yeah
yes
the reason you were getting your error was because you were trying to add a scene that was already added
ok i made a new scene
you will then use code to transision between scenes
so your assets and your hierarchy are two different things
ok
so like if you look at this screenshot
im currentrly in the menu scene. you can tell that because you can see the name of the scene in the top left above the hieracrhy
sorry for my spelling lmao. im sleepy
ur good
now my hierarchy contains everythign within that Menu scene
my assets folder is the thing below
yes
inside of there are your project files. these files can be dragged into any scene
ok
think of your hierachy being like a google doc and then a file on your computer that has images that you want to drag onto the google doc being your project files
you can drag anything from the project files unlimited times into unlimited documents
so what you are gonna wanna do is take your new scene you made and drag it into the build settings
so do i drag my menu scene into my hierachy
ok
now the error message doesnt show up anymore
but ny button wont work
then in your code, do something like this:
using UnityEngine.SceneManagement;
public void LoadGame()
{
SceneManager.LoadScene("NAME OF SCENE (CASE SENSITIVE)" OR INT VALUE OF YOUR BUILD INDEX);
}
only for the load game?
so when you click play you want it to load this next scene right?
yes
if you wanna quit you wanna close the game right?
so quit you have working fine because you wanna quit the game not load a scene. for the loadgame button you want it to load the scene
yes but your script wont work with the code you had previously
keep your script if you wanna use it to load the next scene
ok
i can also call if you wanna screenshare to make it easier for you to understand
its a little complicated lol
yeah so for loading a scene, you want to tell it the name of the scene you want to load or its build index
oh wait your code is not formatted right so it won't work
go back to your previous script you were changing
so just so you understand tell me what you want to do when you press quit game
When i press quit game i want the game to close
perfect
which is Application.Quit
public void QuitGame()
perfect
and you have your button set up to call that script correctly from in the inspector?
i thought you were in your main scene
dont you wanna go to the new scene you created?
isnt the scene i just created specifically for my menu?
isnt your menu scene the one with the play and quit?
do you have a game created?
yes
OHHHH
i see what you are saying my mad
okay perf
so you wanna load into samplescene
do you wanna rename samplescene?
so
when u say loadgame
is it
the script with the quit and play
or just the play that u gave me
your gonna use my code but replace the line where you are reloading the scene with this: cs SceneManager.LoadScene("NAME OF SCENE (CASE SENSITIVE)" OR INT VALUE OF YOUR BUILD INDEX);
replace line 10 in this picture with my code above
ok
send me a screenshot of your code after you put all this in
yes
perf
and just for future reference that value can take an int as well
so like if its #1 in your build index you could put a 1 in there instead of game
i usually go with strings though cause its more readable
it does go to the game scene?
do you have identical UI in your Game scene you still need to delete now that you moved it to the menu scene
yes ofc!
i understand everything much better now
how new are you to game dev?
i started today
oh awesome
ive been doing this stuff for 4 years now haha so its hard for me to remember when I started. but it took a while to understand everything cause there is so much to learn lol
yeah seems pretty complicated