playMaker

Author Topic: Level Loading  (Read 1966 times)

markfrancombe

  • Sr. Member
  • ****
  • Posts: 338
    • View Profile
Level Loading
« on: July 05, 2013, 05:02:57 PM »
OK, one last question before bedtime...

Im clicking an exterior door, and loading the level that is the interior of that building.
I need:
To remove the current level (exterior)
Load the interior
Not destroy 2 game objects. Player and Code (Code is where I keep all my generic stuff, Like cursor handling and gui stuff)
Spawn (not really spawn.. er... place) Place the Player in the correct place inside the door of the interior scene.

On the Load level Action there is "Do not destroy on load", but its not really documented in the wiki...
PLUS theres a separate "Do not destroy on Load" Action.

I tried adding 2 Do not Destroy on Load actions, but my objects WERE destroyed.

What was weird, was that the gameobject that held the FSM that set the Load Level (and the "do not destroy" actions) WAS NOT DESTROYED! And neither were all the heirarchy ABOVE...(parents) of it.

Oh.. and then I need to place the Player... Is that just best done by cludge work.. moving stuff about till it lands in the right place? Like do a SetPosition as soon as the level is loaded?

sorry, am I asking to many questions tonight? Friday too, I should be out dancing!

Mark






jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15398
  • Official Playmaker Support
    • View Profile
Re: Level Loading
« Reply #1 on: July 09, 2013, 01:34:47 AM »
Hi,

 Some weird things here hey...


Some actions do have do not destroy flag built in for convenience, but really, it's the same under the hood.

Repositioning your player should be done with a target, instead of guess. so in your new level, have a placeholder transform that help the player know where to go. Or is it a case where the player could be anywhere? if that so, then you should rely on physics or on your character controller to land on the ground, if that's the case.

as for destroying and not destroying, I never encountered issues with this. One thing to be aware thos, is that fsm get restarted, so you might want to disabled "reset on Disable", I had to fiddle with this when dealing with loading levels and keep managers and all.

bye,

 Jean

markfrancombe

  • Sr. Member
  • ****
  • Posts: 338
    • View Profile
Re: Level Loading
« Reply #2 on: July 09, 2013, 02:15:24 AM »
Dont take this as gospel, didnt really test it last night, but I THINK...

That in the "Do not destroy on load" action, the action works when it it is placed on the object, and set to Self. But its not working if you put the action on another game object and set it to Not destroy ANOTHER game object...
Im not saying theres a bug, might just be a timing thing, that the action removes itself trying to load a new level, before its managed to set an object to NOT get destroyed... or something, I guess THAT object, HAS to have do not destroy on load on it... which doesn't work for me cos I definitely need some random door collider to be destroyed...

No answer needed, Im just gonna test some more...


Mark

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15398
  • Official Playmaker Support
    • View Profile
Re: Level Loading
« Reply #3 on: July 09, 2013, 02:20:45 AM »
Hi,

 don't set this at the last minute, it should be set when the fsm starts, that's maybe where the problem is indeed, a question of timing.

bye,

 Jean