Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: rechronicle on December 18, 2018, 09:05:54 PM

Title: About Don't Destroy On Load[SOLVED]
Post by: rechronicle on December 18, 2018, 09:05:54 PM
Hello,
I want to ask about two things that I can't solve myself at the moment.

1. Let's say that I want to make a puzzle piece game object. I want the specific game object to be picked only once and retain that state (Destroyed/Picked) forever even after going back to that scene again. How to do it?

2. When I use the DontDestroyOnLoad action, the object keeps duplicating when I get back to the scene. (See attachment.) How to work around it?

Please help if you know about it.
Thank you!
Title: Re: About Don't Destroy On Load
Post by: Athin on December 18, 2018, 09:43:59 PM
I'd just make a simple bool on the object if its been picked up or not. when the level loads up, have it do a check on this bool and if it has already been picked up, have it not load.
Title: Re: About Don't Destroy On Load
Post by: rechronicle on December 19, 2018, 01:49:28 AM
Hello,
I was thinking to use the DontDestroyOnLoad for that to check on the bool flip, but problem number 2 occurs.

I mean look at the attachment.
In Unity 2D Gamekit, the gameObjects that you want to persist can be put on every scene. They don't duplicate/stacks when Player move to another Scene even tho they're available on every Scene.
It's quite practical as that allows the user to play directly on any scene without breaking the system.


Or, is there another way to keep things as they are across the Scene (ex: coin picked, door unlocked, boss defeated) other than DontDestroyOnLoad/Global Variable?


I hope my explanation is not too confusing.
Thank you!
Title: Re: About Don't Destroy On Load
Post by: LordHorusNL on December 19, 2018, 10:06:59 AM
Just download the "singleton" actions from the ecosystem, that way the object with a specific reference in the original scene will just overwrite the one in the newly loaded scene.

And uncheck "reset on disable" on your FSM to keep the current state active.