playMaker

Author Topic: Loading progress bar?  (Read 18101 times)

TommyA

  • Playmaker Newbie
  • *
  • Posts: 26
Loading progress bar?
« on: November 27, 2012, 11:57:00 PM »
Hi

How should I make loading screen between scenes with playmaker?
I need loading screen which has loading progress bar related with loading status.
I have NGUI so if possible, I want to make this with NGUI.

I searched help thread but not found any related with this.
Please help me.
Thank you.
« Last Edit: November 28, 2012, 12:14:46 AM by TommyA »

lucaderiu

  • Playmaker Newbie
  • *
  • Posts: 30
    • PlaySys
Re: Loading progress bar?
« Reply #1 on: September 11, 2013, 07:05:50 PM »
Hello,
I am trying to do the same but I am not able to find usefull informations (i don't use NGUI). TommyA you managed somehow to do it?
Someone has a suggestion on how to set a variable with the loaded% of level size?
Thank you
Luca
-----------------------------------------------------
http://www.playsys.games
-----------------------------------------------------

GarthSmith

  • Playmaker Newbie
  • *
  • Posts: 31
  • Games. Math. Code.
    • Garth Smith's Website
Re: Loading progress bar?
« Reply #2 on: September 11, 2013, 07:58:47 PM »
Hello!

As far as I can tell, this might take a little bit of programming for you to do in PlayMaker. If you're not a C# programmer, then consider suggesting this functionality to hutong games.

I'm looking at the Load Level action from the LoadLevel.cs file. This action has a bool "Async" which allows the level to load in the background.

Inside the LoadLevel.cs file, there is a private variable named "asyncOperation" which contains the progress of the level loading.
http://docs.unity3d.com/Documentation/ScriptReference/AsyncOperation.html

You would have to make a custom event and add a public FsmFloat to expose the loading progress, which you can then use to set a progress bar.

 - Garth Smith

lucaderiu

  • Playmaker Newbie
  • *
  • Posts: 30
    • PlaySys
Re: Loading progress bar?
« Reply #3 on: September 12, 2013, 07:07:29 AM »
Thank you Garth! you're right i see the read only variable.
I am not so skilled atm with programming and this sounds like a work for jeanfabre, hopefully he will see this topic ;)
Thanks
Luca
-----------------------------------------------------
http://www.playsys.games
-----------------------------------------------------

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Loading progress bar?
« Reply #4 on: September 13, 2013, 08:08:02 AM »
Hi,

 ok :) Can you test the actions I pasted below? I admit I haven't been able to find the time to test them properly, So I would appreciate, if they work, then I'll put it in the proper section onm the forum.

Basically, I chose to have them as seperate from LoadLevel because it will work for any situation if you implement it manually, within LoadLEvel it would get difficlt to satisfy both asynch and synch loading ( with the "loaded event" issue).

bye

 Jean

escpodgames

  • Hero Member
  • *****
  • Posts: 687
    • Assets
Re: Loading progress bar?
« Reply #5 on: September 13, 2013, 10:09:34 PM »
Hey Jean,

Tried both actions on iOS/PC/mac and can not get them to work :S

lucaderiu

  • Playmaker Newbie
  • *
  • Posts: 30
    • PlaySys
Re: Loading progress bar?
« Reply #6 on: September 15, 2013, 02:12:23 PM »
Hello Jean,
thank you very much! I am trying the actions but I think something is wrong in my usage: I got 0 for unloaded and 1 for loaded.
Tomorrow I'll try the actions with heavy scenes in the game we are working on,  and I'll let you know if the value can pass from 0.00 to 1.00. In fact I think the loading time is the answer.
Thank you
Luca
-----------------------------------------------------
http://www.playsys.games
-----------------------------------------------------

escpodgames

  • Hero Member
  • *****
  • Posts: 687
    • Assets
Re: Loading progress bar?
« Reply #7 on: September 15, 2013, 07:46:28 PM »
So were you able to get a float from 0-1, mine sat at 0 while loading and then it must have hit 1 as the level loaded (wasn't using additive)

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Loading progress bar?
« Reply #8 on: September 16, 2013, 01:19:10 AM »
Hi,

 yes, that's the thing, you need a proper heavy scene to testify it. I'll see if I have time to validate this properly. I'll keep you updated.

bye,

 Jean

lucaderiu

  • Playmaker Newbie
  • *
  • Posts: 30
    • PlaySys
Re: Loading progress bar?
« Reply #9 on: September 16, 2013, 08:40:45 AM »
Hi,
just tried with a heavy level but doesn't work. The float become 1 directly from 0 and then the scene takes 5 seconds to load.
-----------------------------------------------------
http://www.playsys.games
-----------------------------------------------------

escpodgames

  • Hero Member
  • *****
  • Posts: 687
    • Assets
Re: Loading progress bar?
« Reply #10 on: September 16, 2013, 09:01:15 AM »
http://forum.unity3d.com/threads/22366-Application-GetStreamProgressForLevel-for-iPhone
"Application.LoadLevel and Application.LoadLevelAdditive are blocking operations. Thus Application.GetStreamProgressForLevel will return only 0 or 100."

http://answers.unity3d.com/questions/230611/applicationgetstreamprogressforlevel-ios-not-worki.html
" I'm pretty sure Asynchronous progress reporting in this regards has never worked in any version of Unity Free or Unity Pro."

Unity docs says "In the webplayer this returns the progress of this level." so assuming you're building to iOS or Android lucaderiu, it looks like this may not work :(
« Last Edit: September 16, 2013, 09:07:34 AM by LampRabbit »

lucaderiu

  • Playmaker Newbie
  • *
  • Posts: 30
    • PlaySys
Re: Loading progress bar?
« Reply #11 on: September 16, 2013, 09:59:38 AM »
Thanks LampRabbit,
yes we are working for iOS and looks like we'll have to put a fake progress bar :)
-----------------------------------------------------
http://www.playsys.games
-----------------------------------------------------

GarthSmith

  • Playmaker Newbie
  • *
  • Posts: 31
  • Games. Math. Code.
    • Garth Smith's Website
Re: Loading progress bar?
« Reply #12 on: September 16, 2013, 03:52:44 PM »
Hello!

In my experience making progress bars, the progress bar does not work in the following cases:
  • Unity Free: Async loading does not work on Unity Free.
  • Unity Editor: Async loading does not show progress in the Unity Editor. However, when building to my iOS device I see the progress bar.
  • Small or empty scenes: Like many progress bars, the progress bar tends to load in chunks. On small or empty scenes, the scene will load from 0 to 100 in a single chunk, thus showing 0% progress then 100% progress.
- Garth Smith
« Last Edit: September 16, 2013, 04:40:34 PM by GarthSmith »

GarthSmith

  • Playmaker Newbie
  • *
  • Posts: 31
  • Games. Math. Code.
    • Garth Smith's Website
Re: Loading progress bar?
« Reply #13 on: September 16, 2013, 03:58:28 PM »
Also, I don't think Application.GetStreamProgressForLevel is the correct way to get level loading progress. The correct way is to save a reference to the AsyncOperation returned by Application.LoadLevelAsync, then check the progress every frame.

Example:

private AsyncOperation checkThisForProgress = null;

void Start() {
    checkThisForProgress = Application.LoadLevelAsync(1);
}

void Update() {
    if (checkThisForProgress != null) {
        Debug.Log("Progress: " + checkThisForProgress.progress);
    }
}

EDIT: I've never used Application.GetStreamProgressForLevel before, so don't believe anything I say when it comes to that command.
« Last Edit: September 16, 2013, 05:33:03 PM by GarthSmith »