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 Henrique Vilela · Apr 26, 2011 at 01:25 AM · coroutineyieldwaitforsecondsprostartcoroutine

WaitForSeconds problem with Unity Pro

... StartCoroutine(SomeMethod()); Debug.Log("Works fine"); ...

IEnumerator SomeMethod() { Debug.Log("Works fine"); yield return new WaitForSeconds(1);
Debug.Log("Never called"); }

This code above used to work till I upgrade Unity to pro, so I believe the code it-self is ok.

But what could I be doing wrong? Could be a new player setting that comes with pro?

If I change WaitForSeconds for WaitForEndOfFrame or WaitForFixedUpdate, it works. Only WaitForSeconds stuck it.

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 Kourosh · Apr 26, 2011 at 01:32 AM 0
Share

Does it through an error? I mean what exactly you mean by stuck?

avatar image Henrique Vilela · May 03, 2011 at 08:48 PM 0
Share

By stuck I mean that that command never ends.

3 Replies

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

Answer by Ashkan_gc · Apr 26, 2011 at 01:48 AM

it's really strange and i think there is a problem in another side, for example in your project settings/time or ... something changed (timescale or ...) and that could be the source of your problem cause the code is totally ok!

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 Henrique Vilela · May 03, 2011 at 08:47 PM 0
Share

Weird... The timescale was 0, but I never changed it. Thanks, man.

avatar image
1

Answer by cmasterenko · Apr 26, 2011 at 02:35 AM

Have you tried making a new test project with primitives and just that code to see how it functions, I had some script just randomly stop working for me before, but it worked when I rebuilt my project from scratch.

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 Silverfell 1 · Apr 26, 2011 at 02:18 AM

Random thoughts:

1) You're not trying to call the coroutine from Update, are you? That won't work.

2) Try yield return new WaitForSeconds(1.0F); <- just in case.

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 Peter G · Apr 26, 2011 at 02:45 AM 1
Share

Actually you can start coroutines from Update, you just can't have "yields" in the function.

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

No one has followed this question yet.

Related Questions

StartCoroutine important for using yield? 1 Answer

JS Wait for a function to complete - no WaitForSeconds 1 Answer

Coroutines and states 1 Answer

What is wrong with this use of WaitForSeconds? 1 Answer

Alternative to "yield return WaitForSeconds()" in Coroutine with .NET Framework (Unity 2018.4) 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