playMaker

Author Topic: Global Variable "gameobject" loses reference when level is restarted  (Read 1461 times)

ManicMinerUK

  • Junior Playmaker
  • **
  • Posts: 51
As title really - I'm new to playmaker but pretty experienced with state machines etc...

My game is a single scene, as it's mostly randomly generated. For the game I have a bunch of FSMs, each of which will generate a random chain of level elements. Different FSM's will generate the random chain according to different rules, so whilst each run through is different, the "forest level" will choose to spawn trees much more often than the "desert level" fsm - hopefully you get the idea.

When the player selects their level style, I set the game object that contains the appropriate FSM to a global gameobject variable called "SelectedLevel" - this works fine on the first life, but when they die in my level, I call "RestartLevel" and this immediately blanks the global gameobject variable, meaning my LevelStart FSM no longer knows which level-spawner to switch on.

I can sit there with the global variables window open and watch the value go from the intended target to "none" as soon as the player dies.

Is this a bug or intended behaviour? Is there any way to prevent this from happening, as there is no easy workaround that I can think of?

michaelgenn

  • Playmaker Newbie
  • *
  • Posts: 7
  • GenPhi Games
Re: Global Variable "gameobject" loses reference when level is restarted
« Reply #1 on: February 01, 2016, 11:19:19 PM »
Hi!

Did you ever hear or figure out anything on this?  I have a similar post that's been looked at but no answers yet.