#jacol ima create a thread so its easier

1 messages · Page 1 of 1 (latest)

south trail
#

thread

timber fog
#

alright

south trail
#

okay perf

timber fog
#

this is my start screen in my hierachy

#

i kits unorganized for now

#

know*

south trail
#

so what scene are you currently in? you can see by the very top item in your hierarchy?

south trail
timber fog
#

its called sample screen

south trail
#

do you know where that scene is located in your assets?

timber fog
#

yes

south trail
#

and its a file not an object in the hierarchy

timber fog
#

in my scenes folder

south trail
#

perf

#

yep. should look something like this:

timber fog
#

yeah

south trail
#

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

timber fog
#

yeah i understand for now

south trail
#

i just wanna make sure you understand exactly what scenes are first

timber fog
#

now i understand

south trail
#

yeah

timber fog
#

so do i create a new scene

#

for the menu

south trail
#

yes

#

the reason you were getting your error was because you were trying to add a scene that was already added

timber fog
#

ok i made a new scene

south trail
#

you will then use code to transision between scenes

timber fog
#

ok

#

but how do i move my StartScreen folder to my Menu

south trail
#

so your assets and your hierarchy are two different things

timber fog
#

ok

south trail
#

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

timber fog
south trail
#

now my hierarchy contains everythign within that Menu scene

#

my assets folder is the thing below

timber fog
#

yes

south trail
#

inside of there are your project files. these files can be dragged into any scene

timber fog
#

ok

south trail
#

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

timber fog
#

so do i drag my menu scene into my hierachy

#

ok

#

now the error message doesnt show up anymore

#

but ny button wont work

south trail
#

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);
}
timber fog
#

only for the load game?

south trail
#

so when you click play you want it to load this next scene right?

timber fog
#

yes

south trail
#

if you wanna quit you wanna close the game right?

timber fog
#

yeah

#

but i already have a script for this

south trail
#

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

timber fog
#

ah ok

#

can i delete that script then?

south trail
#

keep your script if you wanna use it to load the next scene

timber fog
#

ok

south trail
#

i can also call if you wanna screenshare to make it easier for you to understand

#

its a little complicated lol

timber fog
south trail
#

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

timber fog
#

the one that i asked if i could delete?

south trail
#

this one

timber fog
#

ok

#

im in it

south trail
#

so just so you understand tell me what you want to do when you press quit game

timber fog
#

When i press quit game i want the game to close

south trail
#

perfect

timber fog
#

which is Application.Quit

south trail
#

and what function is currently set to do that?

#

whats the name of that function?

timber fog
#

public void QuitGame()

south trail
#

perfect

#

and you have your button set up to call that script correctly from in the inspector?

timber fog
#

yes

#

it works

#

bottom left it says Quit!

south trail
#

perfect

#

now tell me what you want to do when pressing play

timber fog
#

I want it to change to my scene called SampleScene

#

which is my main scene

south trail
#

i thought you were in your main scene

#

dont you wanna go to the new scene you created?

timber fog
#

isnt the scene i just created specifically for my menu?

south trail
#

isnt your menu scene the one with the play and quit?

timber fog
#

well yes

#

but i created a new scene called menu

#

for those

south trail
#

do you have a game created?

timber fog
#

yes

south trail
#

OHHHH

#

i see what you are saying my mad

#

okay perf

#

so you wanna load into samplescene

#

do you wanna rename samplescene?

timber fog
#

yeah

#

what should i name it

#

Game?

south trail
#

is it gonna contain your game?

#

so yeah I would rename it to Game

timber fog
#

ok

#

i changed the name

south trail
#

perf

#

is your loadgame script attached to a game object within your menu scene?

timber fog
#

so

#

when u say loadgame

#

is it

#

the script with the quit and play

#

or just the play that u gave me

south trail
#

yes

#

to the script with quit and play

#

sorry!

#

my brain lol

timber fog
#

so do i need t he one u gave me?

#

cause its causing errors

south trail
#

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

timber fog
#

ok

south trail
#

send me a screenshot of your code after you put all this in

timber fog
#

ok

south trail
#

perfect

#

and is "Game" like exactly how its spelled

#

remember its case sensitive

timber fog
#

yes

south trail
#

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

timber fog
#

Alright

#

now

#

it works

#

but

#

the menu doesnt disapear

#

when i click play

south trail
#

it does go to the game scene?

timber fog
#

the button works

#

it makes me spawn at the spawnpoint

south trail
#

do you have identical UI in your Game scene you still need to delete now that you moved it to the menu scene

timber fog
#

and quit works

#

oh

#

probably

#

yes

#

it works now

south trail
#

perfectr

#

does that all make sense?

timber fog
#

thank you so much for this great help

#

yes

south trail
#

yes ofc!

timber fog
#

i understand everything much better now

south trail
#

how new are you to game dev?

timber fog
#

i started today

south trail
#

oh awesome

timber fog
#

its for a school project

#

im usually doing 3d models on blender

south trail
#

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

timber fog
#

yeah seems pretty complicated

south trail
#

well good luck! feel free to dm me if you ever have questions

#

and remember to look at documentation

#

also Code Monkey and Brackeys are good youtube resources for coding stuff. Brackeys doesnt make videos anymore but he has a huge catalog of stuff

timber fog
#

Ok thanks alot man

#

Goodnight