playMaker

Author Topic: Previous Scene[SOLVED]  (Read 1390 times)

MichaelPatriot21

  • Playmaker Newbie
  • *
  • Posts: 23
Previous Scene[SOLVED]
« on: January 21, 2019, 04:28:26 PM »
What can I use to load the last loaded scene? Like a back button.
« Last Edit: January 22, 2019, 03:12:01 AM by jeanfabre »

ch1ky3n

  • Full Member
  • ***
  • Posts: 208
Re: Previous Scene
« Reply #1 on: January 21, 2019, 05:41:46 PM »
save the scene string name into a string variable and name it like "PreviousScene".

MichaelPatriot21

  • Playmaker Newbie
  • *
  • Posts: 23
Re: Previous Scene
« Reply #2 on: January 21, 2019, 05:57:08 PM »
Which scene's name am I putting into a variable? I know how to load scenes.

ch1ky3n

  • Full Member
  • ***
  • Posts: 208
Re: Previous Scene
« Reply #3 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

MichaelPatriot21

  • Playmaker Newbie
  • *
  • Posts: 23
Re: Previous Scene
« Reply #4 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.

ch1ky3n

  • Full Member
  • ***
  • Posts: 208
Re: Previous Scene
« Reply #5 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

MichaelPatriot21

  • Playmaker Newbie
  • *
  • Posts: 23
Re: Previous Scene
« Reply #6 on: January 21, 2019, 07:20:33 PM »
I figured out a workaround :). Thank you.