#Help Newbie

1 messages Β· Page 1 of 1 (latest)

thick hedge
#

If you want dedicated chat you can create thread

dense canopy
#

thank you!

#

I'm so lost haha

#

sorry

thick hedge
#

You're good. What part you can't figure out?

dense canopy
#

When I created the game I coded the whole logic on one script, this is the script of the unity the player controls. It's responsible for starting the game, spawning objects and when it dies it just resets its position

#

and cleans the stage

#

now I'm trying to setup a game manager to handle the game state changes

#

the first step I was trying was to create a start screen

#

I can create the start screen and it disappears when i click on play, changing the gamestate and everythin

#

but the whole game loads behind that screen

thick hedge
#

Okay makes sense so far

dense canopy
#

I've tried creating different scenes and load the gam scene only when the button is pressed, but it didnt do anything

#

the second scene started with it

#

I dont know if i should create a different scene for the start menu

#

for example

thick hedge
#

It is common to have separate scene for example Title scene and Main scene

#

What method did you use to load the scene and how it didn't work?

#

It's easy way too, because the scene will be reset if you load again, so you don't have to reset states yourself

dense canopy
#

first i created two scenes, one with the menu panel containing the background image, a simple playbutton and a menumanager. of the playbutton was pressed it calls SceneManager.LoadScene(1)

#

and within the build settings i had both scenes with the correct index

thick hedge
#

Uh huh Sounds about right

dense canopy
#

but when i click on play I can see the other scene being loaded on the background without me pressing the playbutton

thick hedge
#

Are you pressed Play button from the title scene but the other scene loaded?

dense canopy
#

the scene1 loads before me pressing the button

#

my message was confusing πŸ˜„

thick hedge
#

So you were opening the scene 0, press play from Unity, and scene 1 loaded?

dense canopy
#

I click on play, scene0 and scene1 load, I press play and the scene1 is already loaded

thick hedge
#

Because that shouldn't happen, Can you share the script?

dense canopy
#

I click on play (being the playbutton to run the game(

#

sure

#

how's the best way? just copy and paste it here?

thick hedge
dense canopy
#

that's the "whole game" as one entity

#

this is the menumanager which was in a different scene

#

StartGame is the function called on pressing the playgame button within the start menu

thick hedge
#

Hmmm anywhere else is calling StartGame?

dense canopy
#

no

#

that is only called when the button is pressed within the start menu

thick hedge
#

How does the GameManager look like?

dense canopy
thick hedge
#

Hmm it's weird. It should not load scene 1

#

Unless you were opening scene 1 before press play button from Unity

#

Were you editing both scene at the same time?

dense canopy
#

I don't think so

thick hedge
#

Can you still reproduce the issue?

dense canopy
#

yes

#

is it bad if i show you my screen?

thick hedge
#

You can, not bad about it

#

If you can take video it would be great

dense canopy
#

how's the best way to do it?

thick hedge
#

Just take a video and drag into discord

dense canopy
#

ok

#

i'm just finding a way to record my screen πŸ˜„ I have no idea how to do it on windows

#

πŸ˜„

thick hedge
#

Hmmm try Win+alt+R

dense canopy
thick hedge
#

Not the unity editor 😒

dense canopy
#

oh it's not showing the screen

thick hedge
#

Oh you can just show me how you reproduce it πŸ˜„

#

And the button setup, if possible

thick hedge
#

Oh yeah you are editing both scene at the same time

#

That is pretty much why

dense canopy
#

interesting

#

how do I know when I'm editing both at the same time?

thick hedge
#

When you see your hierarchy view on the left

#

There is two scene open

#

Menu and Game

#

Try double-click your Menu scene from project view on the bottom

#

You'll see only one scene open

dense canopy
#

yes

thick hedge
#

Now you can try play button from that scene

dense canopy
#

but then the button within the menu panel doesnt work

#

It can be because the gamemanager is within scene1

thick hedge
#

Oh right. I think you won't need GameManagerOnOnGameStateChanged if you split scenes πŸ˜„

#

Because you'd just Load scene 0, when you want to return to title.

#

But it will be different story for in-game pause menu.

dense canopy
#

I see, so what I could do is just call the loadscene instead of changing the gamestate?

thick hedge
#

Yes, you can do that

#

Tip: You made your GameManager singleton but if you want it to live across scenes, you need to call this

dense canopy
#

Interesting

#

now the menu button doesnt work anymore

thick hedge
#

Are you getting errors?

dense canopy
#

nothing

#

it doesnt even change the color when hovering

thick hedge
#

Are you in Play mode? πŸ˜›

dense canopy
#

yeap

thick hedge
#

Or is it paused, or anything?

#

Can you do video again?

dense canopy
#

it didnt show the color panel πŸ˜„

#

but it was just supposed to show that it should have changed the button appearance with hover

#

or click

thick hedge
#

Oh I think you're missing EventSystem in your scene πŸ˜„

#

Copy it from the Game scene?

thick hedge
dense canopy
#

yaaay

#

it works

#

adding the event system

#

made it work how it's supposed tro

#

thank you very much!

#

you saved a life today πŸ˜„

#

I guess we can close this thread then

#

thank you again

thick hedge