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 tvwxyz · Jul 29, 2014 at 02:21 AM · coroutinelong

Coroutine with a long procedure?

I have a terrain generating procedure that takes 30-60 seconds to run every time it's called and works to my satisfaction. I might be able to optimize it a bit so it doesn't take quite as long but will still take several seconds to run. (The procedure has several nested loops.)

I want to display a "loading..." screen so the user doesn't think the game crashed. I understand how to use coroutines but it seems like I will have to create several methods that perform specific steps of the procedure and have the coroutine constantly check their status until they're finished.

Any ideas on the best way to do this? (Let me know if my explanation needs clarification.)

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

2 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by smallbit · Jul 29, 2014 at 02:35 AM

If it only takes several seconds, you can just do some simple animation that is not related to the real progress of generation i.e. loading bar in windows, or loading texts with dots.

Than if it goes longer than that, you can distract user by showing the actual activity, like they do in Sir you are being hunted, or minecraft (i.e. generating north clusters etc, which will be displayed on entering to each of your loops). You also can print out time.time of finishing each of your loops (in editor), and assign them estimate progress (like 20%, 50%) than display it on the screen along with the info what the game is doing right now. This should calm the user.

Finally you can estimate more precisely how much does each step take from overall loading time, each iteration of each inner loop and show the more precise progress based on that. Or you can count the outcome (number of triangles etc.. in the generated scene in the scene (in editor mode)), and than calculate percentage on run via currently generated/maximum counter. This is however complicated, and user does not need to know it exactly.

One advice I've seen a lot, is to put a "Hint of a day" field on the loading screen (.i.e you can get better loot from higher level enemies etc..) this always takes users mind of the loading time. I've seen somewhere multiple hint changing each 5 secs or so.

Hope it will give you the idea !

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

Answer by tvwxyz · Jul 30, 2014 at 02:23 AM

For those interested, here is a link to the solution I'm using until I get Unity Pro... http://chicounity3d.wordpress.com/2014/01/25/loading-screen-tutorial/

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

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

23 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Taking a sequence of screenshots 1 Answer

Starting Coroutine within Start method 1 Answer

Method returning data from WWW 1 Answer

How to stop coroutines or functions 2 Answers

StartCoroutine not working for unknown reason 0 Answers


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