Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: MichaelPatriot21 on January 21, 2019, 04:28:26 PM

Title: Previous Scene[SOLVED]
Post by: MichaelPatriot21 on January 21, 2019, 04:28:26 PM
What can I use to load the last loaded scene? Like a back button.
Title: Re: Previous Scene
Post by: ch1ky3n on January 21, 2019, 05:41:46 PM
save the scene string name into a string variable and name it like "PreviousScene".
Title: Re: Previous Scene
Post by: MichaelPatriot21 on January 21, 2019, 05:57:08 PM
Which scene's name am I putting into a variable? I know how to load scenes.
Title: Re: Previous Scene
Post by: ch1ky3n on January 21, 2019, 06:03:05 PM
First you should use action “get scene name’ and save it to string variable say PreviousScene. This will save your current active scene ‘s Name.

Next you load other scene right?
Whenever you want to go back, you can load scene, use scene name and use the “PreviousScene” variable earlier. This will load the earlier scene
Title: Re: Previous Scene
Post by: MichaelPatriot21 on January 21, 2019, 06:44:48 PM
Okay, so here's what I'm trying to do. I'm making a point-and-click game that jumps between scenes. The play character carries around a laptop they can access in every scene. When they press the power button on the laptop it's supposed to take them back to the scene they accessed the laptop from.
Title: Re: Previous Scene
Post by: ch1ky3n on January 21, 2019, 07:14:24 PM
Ok, let’s assume you have 2 scenes, each with their unique file name:
GameWorldScene
LaptopScene

In the GameWorldScene, player can open the laptop and take it to the other scene.

So,
When the Power button pressed, “Get Active scene name” and save it to a variable
string_CurrentScene = “GameWorldScene”
Then, you load scene “LaptopScene” which takes player to LaptopScene. After player done with this scene, you can make an action “load scene by name” inside the name box, use the variable string_CurrentScene that contain “GameWorldScene”.

Another way,
If your laptop scene doesn’t involve any graphic that could overlap the GameWorldScene, you could use Load Additive, so there will be 2 scenes active inside your hierarchy

Also,
If you have tons of scenes to jump around, you better use Array to store your scene information.

Hopefully it helps
Title: Re: Previous Scene
Post by: MichaelPatriot21 on January 21, 2019, 07:20:33 PM
I figured out a workaround :). Thank you.