playMaker

Author Topic: About Don't Destroy On Load[SOLVED]  (Read 727 times)

rechronicle

  • Junior Playmaker
  • **
  • Posts: 71
  • Medievaliant
    • View Profile
    • Indie RPG Creator
About Don't Destroy On Load[SOLVED]
« on: December 18, 2018, 07: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!
« Last Edit: December 20, 2018, 02:19:16 AM by jeanfabre »

Athin

  • Full Member
  • ***
  • Posts: 120
    • View Profile
Re: About Don't Destroy On Load
« Reply #1 on: December 18, 2018, 07: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.

rechronicle

  • Junior Playmaker
  • **
  • Posts: 71
  • Medievaliant
    • View Profile
    • Indie RPG Creator
Re: About Don't Destroy On Load
« Reply #2 on: December 18, 2018, 11:49:28 PM »
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!

LordHorusNL

  • Beta Group
  • Full Member
  • *
  • Posts: 165
    • View Profile
Re: About Don't Destroy On Load
« Reply #3 on: December 19, 2018, 08: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.