playMaker

Author Topic: Constant info  (Read 90 times)

Seiryu33

  • Junior Playmaker
  • **
  • Posts: 76
    • View Profile
Constant info
« on: December 10, 2017, 08:27:28 AM »
I haven't found anything relevant to this topic, but how do I get information to carry over scene to scene? Like if I want a game object to remain active or even just coins and health. I thought about using global floats but I didn't work the way i planned. Any tips or advice would he greatly appreciated. Thanks.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 2528
    • View Profile
    • jinxtergames
Re: Constant info
« Reply #1 on: December 10, 2017, 11:50:53 AM »
Hi.
You can use an asset called easy save to save/load values
or
You can have a gameobject with data which you don't destroy when changing scenes
with the action "Don't Destroy On Load"

Seiryu33

  • Junior Playmaker
  • **
  • Posts: 76
    • View Profile
Re: Constant info
« Reply #2 on: December 10, 2017, 02:27:41 PM »
I thought of that too but then I had problems with enemies not reacting to the player since they have to be able to recognize them. Any suggestion on how to fix the enemy A.I so they react accordingly after the scene changes?

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 2528
    • View Profile
    • jinxtergames
Re: Constant info
« Reply #3 on: December 11, 2017, 04:22:29 PM »
Hi.
Maybe this is a possibility:
if you have a lot already going on in your project, i would make an empty object and place an fsm on that (called DataHolder for example)
Then just before changing scene, use 'set fsm' actions to set the data you need for the other scene.

then on the other scene you need to use 'get fsm' actions to get the data you need @ the start of your scene or when you need it.

To connect you need to use a global (DataHolderObj) and also you need to set the 'DataHolder' gameobject to the global by using "Set Game Object"

Then you also need to use "Send Active Scene Changed Event" and point it back to do the "Set Game Object" again

You could do something similar to the player instead of making the dataholder.

Make a backup!! and play around a bit to see what works best.
« Last Edit: December 11, 2017, 05:01:44 PM by djaydino »