Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Michael 12 · Mar 23, 2012 at 09:09 PM · progress-bar

Web player not using load screen properly

Does anyone know why the unity web player does not use the load screen properly? http://dl.dropbox.com/u/52270474/WebPlayer.html

I've been hunting all over hells half acre trying to find a good load method.. how the hell do you do this... this is what I've been trying and it's clearly NOT frackin working!!

 var progress : float = 0;
 var pos : Vector2 = new Vector2(20,40);
 var size : Vector2 = new Vector2(247,13);
 var progressBarEmpty : Texture2D;
 var progressBarFull : Texture2D;
 
 private var loading : boolean = false;
 var levelName : String;
 
 function OnGUI()
 {
     GUI.DrawTexture(Rect(pos.x, pos.y, size.x, size.y), progressBarEmpty);
     GUI.DrawTexture(Rect(pos.x, pos.y, size.x * Mathf.Clamp01(progress), size.y), progressBarFull);
 } 
 
 function Update()
 {
     if(!loading && Application.GetStreamProgressForLevel(levelName) == 1)
         progress = Time.time * 0.05;
     Application.LoadLevel(levelName);
 }
Comment
Add comment · Show 2
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image You! · Mar 24, 2012 at 01:40 AM 0
Share

Why are you checking if "Application.GetStreamProgressForLevel(levelName)" equals one? It would only equal one when it is finished. This might be a problem

avatar image Michael 12 · Mar 24, 2012 at 01:56 AM 0
Share

What should it be then?

1 Reply

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by Bunny83 · Mar 24, 2012 at 02:07 AM

I've formated your code mess and indent the code the way you've programmed it. As you can see the if statement only covers the progress = Time.time * 0.05; line.

Actually this line should be executed without any condition since it just fakes the progress and it doesn't make much sense to do this when the level is loaded.

All this is useless since Application.LoadLevel is outside of your if-condition so it will be executed right away in the first frame.

The most important thing is: Have you build a streamed webplayer and considered all streaming-tips here ?

edit
Here how your Update function might should look like:

 function Update()
 {
     progress = Time.time * 0.05;
     if(!loading && Application.GetStreamProgressForLevel(levelName) == 1)
     {
         Application.LoadLevel(levelName);
     }
 }

It's ok to omit the brackets as long as you only want a single statement in the if-body, but it seems you're not that familiar with the common syntax.

Comment
Add comment · Show 9 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Michael 12 · Mar 24, 2012 at 02:15 AM 0
Share

I'm not sure I really follow, sorry for it messing up my code it does it every time, "Paste code here" so I do and instant F* Up. I'm NOT using Pro. so would any of this make a diference? I keep reading all sorts of crap about this?

avatar image Michael 12 · Mar 24, 2012 at 03:00 AM 0
Share

Well I must admit Bunny83, it's working a little better, but $$anonymous$$aybe I'm not quite using it properly because although the load bar is actually moving now it finishes and there is still quite a bit of a wait before my level loads... not too long but a little bit of a wait... I was reading in the strea$$anonymous$$g tips to make my first level small.... maybe I need to make a small game level of the inside of Bud's house just so my players can kill a little time exploring and getting used to the controls?

avatar image You! · Mar 24, 2012 at 03:17 AM 0
Share

"Application.GetStreamProgressForLevel()" is a float. This means that you can take the value, put it in a variable, and use it in the progress bar. Example:

function Update(){

var loadLevel = Application.GetStreamProgressForLevel(levelname)

progress = loadLevel * 0.05

if(!loading && Application.GetStreamProgressForLevel(levelname) == 1){

   Application.LoadLevel(levelname)

}

}

avatar image Michael 12 · Mar 24, 2012 at 04:08 PM 0
Share

I dunno, I can't tell if it's doing what it's supposed to maybe someone can check out the link and see if it's working at there end, it's seems to Frack up on $$anonymous$$e all the time something about "Bad File length" or something?!?! http://budthespudgame.net76.net/WebPlayer.html

avatar image Bunny83 · Mar 25, 2012 at 02:54 AM 0
Share

There's something wrong with your webbuild. The file should be 34.3 $$anonymous$$B but it's just 15.6 $$anonymous$$B. $$anonymous$$aybe your hoster has a max file limit (around 16000 $$anonymous$$B ~ 15.625$$anonymous$$B) or your upload is corrupted. Check your filesize and whether your hoster has a limit or not.

edit
If i'm not on the wrong hoster it seems they don't have a limit. So check the filesize on your server and compare it with your local file (compare the byte values, not $$anonymous$$B or $$anonymous$$B) and reupload it if the file is corrupted.

Show more comments

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

How to make a load screen with a load bar 1 Answer

How would you make an energy bar, loading progress bar, health meter, or other visual gradually fill up? 6 Answers

Lifebar Help 1 Answer

Power up timer... 1 Answer

Accurate scene loading progress bar... 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges