Playmaker Forum

PlayMaker News => General Discussion => Topic started by: reveille on January 06, 2018, 11:03:00 AM

Title: Activating objects between scenes
Post by: reveille on January 06, 2018, 11:03:00 AM

Hope someone can help.
How do you activate an object say a weapon on a character when it is brought or unlocked in the shop scene-in another scene.
Title: Re: Activating objects between scenes
Post by: GonerGames on January 06, 2018, 01:27:11 PM
Use a global variable in Playmaker.
eg. Weapon 1 - Bool - True or false. (true unlocked)

You can reference global variables from any scene.

Title: Re: Activating objects between scenes
Post by: djaydino on January 07, 2018, 08:47:02 AM
Hi,
Be careful with using globals.
Always try to minimize using globals.

Another way is to get into scene managing.

And keep your player as a scene with all its data, and load different scenes/levels.

Check out this unity video it will explain more how it works :


search for 'scene' in your action window to see the available actions for this.
Title: Re: Activating objects between scenes
Post by: verybinary on January 08, 2018, 03:28:00 AM
I like Dino's answer, and I'm not sure if the management technique that I started planning logistically was what he was actually talking about, but either way, he got the ball rolling. Ill check it out when I'm not at work. Can't youtube here.

But my original help would be to put your hasweapons variables/array on the player itself. Then your player could keep up with it, and your menu system and player can chat over a coffee when the menu loads.

I also don't think a global array would cause a major cleanup issue, especially compared to individual weapons, but it wouldn't seem "right" to use that as a global anyways.
Title: Re: Activating objects between scenes
Post by: djaydino on January 08, 2018, 03:37:09 AM
Hi.
One of the reasons i prevent using globals is that they are a lot easier to be hacked.
i only use them sometimes to connect to my game manger fsm or some other managers (controller / audio / ai / etc..)

Title: Re: Activating objects between scenes
Post by: verybinary on January 08, 2018, 04:58:21 AM
Ah, I assumed it had something to do with garbage disposal. Everything I've done has been offline and "so what if you hack it", but still thrifty with globals, only used generally for a few that the settingsmenu prefab sets. Everything else on prefabs that will definitely be active when the variables will be used.

And was that video talking about a scene that held game managers and additive scene loaders? I've been adding an "on every scene" prefab with game managers and such while loading scenes as I needed them. But using a gamemanager scene to load everything on top of, could be beneficial(pending performance tests). Was that even what the video is talking about?
Title: Re: Activating objects between scenes
Post by: djaydino on January 08, 2018, 05:19:40 PM
Hi.
Quote
Everything I've done has been offline and "so what if you hack it"
I said actually 'One of the reasons'
Using to many Globals make the project messy (especially on bigger projects)
You can't rename globals.
and i mean when you release your game on a platform, it is a lot easier for cheat engines to hack your game. :)

Quote
And was that video talking about a scene that held game managers and additive scene loaders?
It was just a sample on how you can use scenes a different way

You can for example setup a scene with the player and with the ui (score health and so on) and have the player fsm connected to the ui and use other scenes for the level and or other things.

But i think we are getting off topic here on reveille's post. :)