playMaker

Author Topic: Constant info  (Read 851 times)

Seiryu33

  • Full Member
  • ***
  • Posts: 109
    • 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: 4651
    • 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

  • Full Member
  • ***
  • Posts: 109
    • 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: 4651
    • 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 »

Seiryu33

  • Full Member
  • ***
  • Posts: 109
    • View Profile
Re: Constant info
« Reply #4 on: January 24, 2018, 08:33:53 PM »
Okay so what I did was make the player and player cam it's own scene then set player and status bar as a global game object. The scene loads fine when it's used Async. But i wanted to try loading the scenes as a Single so that there's better performance. I tried using the Don't destroy on load action, but the subsequent scene still loaded without the scene with the player loading with it. Do I put the action on the subsequent scene?