playMaker

Author Topic: G.O. moving between scene's  (Read 2496 times)

wallaceb68

  • Junior Playmaker
  • **
  • Posts: 87
G.O. moving between scene's
« on: February 27, 2014, 12:04:50 AM »
i have a G.O. (player) in a room(scene 1) that has 4 doors around the room, the player can pick from 6 different guns and walk up to a door where there is a trigger to open door, the trigger sends the player to another scene. (the player also has a donotdestroy action on it) once the player is done in the room he wants to go back to the main room (scene 1) so he walks back to the door and it opens and when he steps into it, it sends him back to scene 1. at this point he can either walk up to another door with the same gun or go over and pick a different one, and walk into another room,  the problem is, that when the player go's back to scene 1 from scene 2, there is double of himself. how do you guys handle this problem? please try to explain it into detail if you can, because i am having alot of troubles trying to figure this out.

redikann

  • Full Member
  • ***
  • Posts: 174
Re: G.O. moving between scene's
« Reply #1 on: February 27, 2014, 03:32:43 AM »
Scene 1 doesn't know any better. If you have your scene set up with a player G.O.
it will always be loaded when scene 1 is loaded. It won't care if your carrying over a player G.O. So now you have to decide how you want to create your player. You could create him after the level has loaded and only if there isn't an instance of a player G.o. already in the scene. Don't place a player in your scene but instead  instantiate a pre fab player that will only be loaded when there is no other player object.
« Last Edit: February 27, 2014, 03:35:10 AM by redikann »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15620
  • Official Playmaker Support
Re: G.O. moving between scene's
« Reply #2 on: February 27, 2014, 03:39:22 AM »
Hi,

 typically, you can also go for a singleton approach.

 Each of your scenes do have everything built in, only they destroy themselves if not needed.

I just replied on the same topic here:

http://hutonggames.com/playmakerforum/index.php?topic=6481.msg31681#msg31681

 use the action "singleton Manager" on your player as the first thing on START state, and if it's already there it will destroy itself.

 Yes, you can go for a higer level of management as redikann says, this is good also, but more work on some ways.

Also, for editing reasons, this case always make sense, you want to be able to load a particular scene without having to play the whole game so some elements are therre only to test and edit the scene, so this is a common issue.

bye,

 Jean

wallaceb68

  • Junior Playmaker
  • **
  • Posts: 87
Re: G.O. moving between scene's
« Reply #3 on: February 27, 2014, 08:18:55 AM »
Quote
use the action "singleton Manager" on your player as the first thing on START state, and if it's already there it will destroy itself.
I dont seem to have this action in my ACTION list, where can i get it?

MOD: ok i found it on another post, and implemented it, but that still didnt work, when i leave scene 1 and go into scene 2 then back to scene 1 it duplicates the G.O. that have a "donotdestroy" action on them.
« Last Edit: February 27, 2014, 08:49:24 AM by wallaceb68 »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15620
  • Official Playmaker Support
Re: G.O. moving between scene's
« Reply #4 on: March 04, 2014, 06:40:40 AM »
Hi,

 yes if you don't have this singleton manager on them gameobject it will.

bye,

 Jean