playMaker

Author Topic: Async Load Level but don't trigger the level change  (Read 6624 times)

PET

  • Full Member
  • ***
  • Posts: 137
    • View Profile
    • GamerPET
Async Load Level but don't trigger the level change
« on: July 13, 2016, 02:57:40 AM »
Hey there,

I'm loading a leve async... however as soon as the loading finishes the level automatically changes. Is there a way to only trigger the loading change when I tell it to?

Thanks
Technical Game Designer
www.GamerPET.com

ARK1391

  • Playmaker Newbie
  • *
  • Posts: 2
    • View Profile
Re: Async Load Level but don't trigger the level change
« Reply #1 on: July 13, 2016, 12:48:48 PM »
I would also like an answer to this question as I am having the same issue.

PET

  • Full Member
  • ***
  • Posts: 137
    • View Profile
    • GamerPET
Re: Async Load Level but don't trigger the level change
« Reply #2 on: July 15, 2016, 01:53:51 AM »
 :-[ :'( :'(
Technical Game Designer
www.GamerPET.com

PET

  • Full Member
  • ***
  • Posts: 137
    • View Profile
    • GamerPET
Re: Async Load Level but don't trigger the level change
« Reply #3 on: July 17, 2016, 12:25:08 PM »
Is this really not possible?
Technical Game Designer
www.GamerPET.com

elusiven

  • Full Member
  • ***
  • Posts: 233
  • Debt we all must pay...
    • View Profile
Re: Async Load Level but don't trigger the level change
« Reply #4 on: July 18, 2016, 05:39:32 AM »
Have you had a look on google first?

http://answers.unity3d.com/questions/137261/loading-level-async-without-switching-the-level-im.html

there is plenty of info on this

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15371
  • Official Playmaker Support
    • View Profile
Re: Async Load Level but don't trigger the level change
« Reply #5 on: July 18, 2016, 06:17:08 AM »
hi,

 Yes, this is going to be a problem right now. The best solution is to have an fsm inside each sublevel you are loading and have then send a custom global event "ON SUB LEVEL LOADED" and you can even pass some data to it with the name of the scene just loaded. That would be how I would do this personally.

To make sure this is efficient, have this on a dedicated dummy GameObject, and once you have broacasted that event, destroy it, so that if you load it again, you won't have possible duplicates and similar issue.


Bye,

 Jean

PET

  • Full Member
  • ***
  • Posts: 137
    • View Profile
    • GamerPET
Re: Async Load Level but don't trigger the level change
« Reply #6 on: July 19, 2016, 01:58:45 AM »
Hey Jean,

So let me see if I understand.
I have 3 scenes that I'm loading async ... each scene after another.

01 -> 02 -> 03

On the 2nd scene when loading the 3rd one I want to wait until the level change. I want to immediately load the 3rd scene, but I don't want it to automatically change when the 3rd scene is loaded. I want to press a button in Scene 2, and when I press that button go to scene 3.

You are suggesting to make a GameObject with a FSM on scene 3, create a custom global event called "ON SUB LEVEL LOADED" ... and when the scene 3 will load, it will send that custom global event. I can use "Broadcast All" I guess?

But... how do I stop Scene 2 FSM to not change the scene when the Scene 3 loads? Also, how do I change to Scene 3 when I want it? With what event?

I could use Loaded Event from the "Load Event" action, go to a state where I wait for the ENTER key, and when that key is pressed go to a state that changes the levels, but what action do I use there?

I hope I made myself clear.

Thanks Jean.
Technical Game Designer
www.GamerPET.com

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15371
  • Official Playmaker Support
    • View Profile
Re: Async Load Level but don't trigger the level change
« Reply #7 on: July 19, 2016, 05:32:44 AM »
Hi,

 that's already down to y custom implementation.

 If scene two is listening to sub level loading, it can then disable some features when it detect that level 3 is loaded. that would work very well.

 I would organize your levels by number but also by depth, level 3 is depth 3, so from level 2, if you want to load another level that would be like level 3 but a variant, I would suggest that you also set n int data on the global event for sub leve loaded to keep track of the depth.

 so when you load 01, the even has a string "01" and an int '0', when it loads "02", the event will have string "02" and an int set to '1', etc etc

so now you have two different information from your level loading system, one is the name, one if the depth, and with this, I am positive that within level2 you can then listen to all new sub level loaded an act accordingly.

Bye,

 Jean

PET

  • Full Member
  • ***
  • Posts: 137
    • View Profile
    • GamerPET
Re: Async Load Level but don't trigger the level change
« Reply #8 on: July 19, 2016, 05:54:09 AM »
Damn. This is a bit to complicated. Isn't there a way to do it easier?

http://docs.unity3d.com/540/Documentation/ScriptReference/AsyncOperation-allowSceneActivation.html

There have to be some stuff that could be added in PlayMaker... like a checkbox or something :D
Technical Game Designer
www.GamerPET.com

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15371
  • Official Playmaker Support
    • View Profile
Re: Async Load Level but don't trigger the level change
« Reply #9 on: July 20, 2016, 11:51:30 PM »
Hi,

 Actually, my solution would be actually easier then implement asynch operations, even with proper wrappers so you don't have to code anything. Because you'll end up having to build a game manager for your level loading and this general means lots of extra work to cover every case in a generic way.

But, you have a good point actually, I meant to tackle the new SceneManager scope of functionnalities, it's something that I indeed think we should support fully.

I created a Task on Trello, please up vote, but for sure I'll tackle it no matter what.

Bye,

 Jean


PET

  • Full Member
  • ***
  • Posts: 137
    • View Profile
    • GamerPET
Re: Async Load Level but don't trigger the level change
« Reply #10 on: July 21, 2016, 02:55:21 AM »
I voted on trello :)

Hopefully you can implement this. My scene manangement is pretty straight forward, Scene 1 -> Scene 2 -> Scene 3 and that's it ... but even like this I don't know how to do it without code :(

Technical Game Designer
www.GamerPET.com

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15371
  • Official Playmaker Support
    • View Profile
Re: Async Load Level but don't trigger the level change
« Reply #11 on: July 22, 2016, 12:18:30 AM »
Hi,

 Does the solution I mentionned above not working ( while I'll work on this) ?

 Bye,

 Jean

PET

  • Full Member
  • ***
  • Posts: 137
    • View Profile
    • GamerPET
Re: Async Load Level but don't trigger the level change
« Reply #12 on: July 22, 2016, 01:32:19 AM »
I didn't really understood the above solution. I don't know what "sub level loading" is.

Like I got the idea of a FSM in Scene 3 that activates when the Scene 3 has loaded... but I don't know how to make Scene 2 to stop changing the level.

But this is not 100% urgent. I can wait like 1 month.
Technical Game Designer
www.GamerPET.com

dudebxl

  • Hero Member
  • *****
  • Posts: 602
    • View Profile
Re: Async Load Level but don't trigger the level change
« Reply #13 on: July 22, 2016, 07:48:35 AM »
Hey guys,
 Fyi there is whole bunch of scene manager actions on the ecosystem

PET

  • Full Member
  • ***
  • Posts: 137
    • View Profile
    • GamerPET
Re: Async Load Level but don't trigger the level change
« Reply #14 on: November 16, 2016, 01:00:26 AM »
Hey Jean. I saw Trello ... is it done? :D
Technical Game Designer
www.GamerPET.com