playMaker

Author Topic: Communicating between different scenes  (Read 1694 times)

misterjuly

  • Sr. Member
  • ****
  • Posts: 357
Communicating between different scenes
« on: July 02, 2021, 05:48:53 PM »
Hello,

I want to create a character select screen and I want to be able to select a character in one scene and then have the game remember that character so that in the actual game it is activated. How do I make it so that I can activate/deactivate a character in one scene and have that character selected in the next scene. My thought process would be to have all the characters on one parent game object and activate and deactivate certain children of the player so that only the proper things are activated. The problem is I need to select the character in a different scene. How do I go about doing this? Thanks!

ToxicFrog

  • Beta Group
  • Full Member
  • *
  • Posts: 139
Re: Communicating between different scenes
« Reply #1 on: July 03, 2021, 05:26:47 PM »
There's probably a better way, buy you could try:

1. Don't Destroy on Load
2. Move to Scene

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7618
    • jinxtergames
Re: Communicating between different scenes
« Reply #2 on: July 04, 2021, 06:45:02 AM »
Hi.
for darklight i have a separate scene for the player.
and i load other scenes additive.
and i use a global variable (gameboject) for player reference.

on the level scene i have a Level manager. when loaded it will move the player to a position and activate (and some fade in animation)

...

  • Beta Group
  • Hero Member
  • *
  • Posts: 1294
Re: Communicating between different scenes
« Reply #3 on: July 06, 2021, 02:59:30 PM »
For my game, i stored the selected ship into enum. I have globals manager (which is one of the few global variables in game) which is marked as don't destroy on load. When the game starts, i send the event to globals manager, switch enums and do the rest of the stuff based on enum.