Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 wkmccoy · May 26, 2011 at 01:11 PM · loadingonguiredraw

GUI Redraw stall while loading a new prefab. Loading... message

I have a Model Viewer program that can load several different Hi-poly models. I run a script on each model to add things to it for use on the screen (each part has a gizmo script and collider added/verified)

I have a series of button created in the ONGUI, one is to list the models you can load. That is a spawned Window from the ONGUI. The buttons in there calls the LoadModel Function, which instantiates the prefab and then calls a separate script to do some more work.

In the meantime, I wanted a LOADING... Texture to appear, but it does not appear until the model is done (meaning it waits until all the work is done)

So the function calls are stalling any GUI redraws.

My Question is, how do i force the GUI to put up the message LOADING... before doing the work to load the models. (so the user is not wondering what is going on for the 4-6 seconds it seems to be doing nothing and presses the button again!)

The ONGUI function calls seem to be stalled while the load and other script are running, like control has been given to them before continuing the normal cycle.

I can fix this with a series of booleans and work arounds, but figured there might be a force REDRAW or some kind of command, but can't seem to find that...

Any suggestions?

Comment
Add comment
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

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by Molix · May 26, 2011 at 01:38 PM

This sounds like a good time to use a coroutine. When the button is pressed, start a coroutine to do the load. The loading coroutine should yield periodically to allow the rest of the game (e.g. the OnGUI) to run. There's a good example of yielding when doing 'work' in this question (where it Iterate()s you'd be loading some chunk of your model).

Comment
Add comment · Show 1 · 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 wkmccoy · May 26, 2011 at 01:58 PM 0
Share

was confused since Javascript does not use StartCouroutine. $$anonymous$$y solution was so easy, I was laughing. I just put a yield; as the first line of my load$$anonymous$$odel function, and walla, the loading pops up and the load$$anonymous$$odel continues as designed. I should have ready more closely that only C# scripts need the StartCoroutine Thanks for your help. : ]

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

1 Person is following this question.

avatar image

Related Questions

My unity project won't load my level for editing on a different PC 0 Answers

How can I store and load levels efficiently? 2 Answers

Scene Loading occasionally breaks Rigid Bodies... 1 Answer

WebGL loading optimization 0 Answers

Load file on Android 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