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 Fattie · Sep 03, 2012 at 02:39 PM · yieldcoroutines

So does StopAllCoroutines also CancelInvoke ?

every great piece of code to blow stuff up, starts with this...

   CancelInvoke();
   StopAllCoroutines();

but I'm just curious, does anyone know if the latter actually does anyway the former (or indeed, vice versa?)

Thanks!

Another related point to stuff in here: I've always assumed that - this is in Javascript - any routine which uses yield; even once, is then, a coroutine. Is that correct?

But then, if you stick :IEnumerator after the function name, does that force it to be a coroutine? What about if you have the :IEnumerator, but, actually never use yield; in the routine? Again this is U/S

No big deal just curious if anyone happens to know precisely the exact amswer to this. Cheers

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
Best Answer

Answer by Eric5h5 · Sep 03, 2012 at 04:48 PM

No, StopAllCoroutines won't cancel any Invoked functions, nor will CancelInvoke affect any coroutines. (But come on, it would take you 10 seconds of experimentation to confirm this!)

Unityscript can use type inference for functions as well as variables, so yes, any usage of yield implicitly causes the function to return IEnumerator.

As to whether a function that returns IEnumerator but never actually does any coroutine stuff would be called a coroutine, that's perhaps a matter of semantics, but I would say no: coroutines always return IEnumerator, but it's not true that an IEnumerator always means you're using it in a coroutine.

Comment
Add comment · Show 2 · 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 Fattie · Sep 03, 2012 at 05:16 PM 0
Share

1 - awesome, thanks!

2 - I know, but it's an opportunity to chat online!

3 - I guess what I meant is .. um .. if you shove :IEnumerator on the end, but do NOT actually mention yield within. Then, will StopAllCoroutines actually, err, stop that routine? I guess this is conceptually daft because it's never "in the middle" of that routine in any sense, nothing is running simultaneously.

I guess what I mean is "In the case described does Unity bother flagging it as a routine that it has to look through for 'yields' even though there are none| ... anyway .. fogget about it :) I've got the idea

3B - your third last word is meant to be "as" not "in" correct.. ..??

thahks again

avatar image Eric5h5 · Sep 03, 2012 at 05:26 PM 0
Share

No, I meant what I said. ;) See here: http://msdn.microsoft.com/en-us/library/system.collections.ienumerator.aspx

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

8 People are following this question.

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

Related Questions

Coroutines and states 1 Answer

Are coroutines freezing my game? 0 Answers

How do I properly use Coroutines, yield and animators to sequence commands ? 2 Answers

Inconsistent StopCoroutine behavior with CustomYieldInstruction 1 Answer

Problem with Stopping Nested Coroutines: Control Never Returned to Parent 3 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