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
2
Question by sandworm · Jul 22, 2011 at 05:03 PM · wwwstopstopcoroutinecancel

Cancel WWW post operation

Is it possible to cancel a WWW operation once it has been started?

Comment
Add comment · Show 3
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 Bunny83 · Jul 22, 2011 at 05:38 PM 0
Share

Good question. I'm not sure what happens when you just "null" the reference to the www instance. If it works you can't use yield of course since yield will store the reference in the coroutine and there's no way to release it (maybe StopCoroutine but that's not a good approach imho).

You can use a coroutine that checks isDone in a loop. This loop can be aborted by your own condition.

But that's all just guessing. It's definitely something that should be included in the www class.

avatar image sandworm · Jul 22, 2011 at 05:48 PM 0
Share

Thanks for that, Bunny83. I have tried using a top level while loop with a cancel condition, which seems to stop the routine but not the www operation. Unfortunately I'm afraid I can't stop the coroutine since it requires 3 args, and there's no clean way to rewrite it down to one so I can start it with the string method of StartCoroutine (and thereby stop it).,

avatar image Bunny83 · Jul 22, 2011 at 06:42 PM 0
Share

Well, you don't have to stop it, just make sure that the www reference isn't passed to the coroutine handler and null it. It will take some time until the garbage collector removes it.

Suddenly it came to my $$anonymous$$d that is could work with Destroy(www).

1 Reply

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

Answer by Dreamora · Jul 24, 2011 at 11:12 PM

You can stop a request as it takes place. To do so you make use of WWWs inheritance as it inherits from IDisposable, which allows you to call

 wwwObject.Dispose ();

to basically destroys it forcefully. But be aware that WWW does more than just download. Audio, Texture and AssetBundles are automatically loaded once downloaded and if you dispose that, hell can break lose basically.

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 sandworm · Jul 27, 2011 at 02:09 AM 0
Share

Thanks Dreamora, that's what I needed!

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Stop instance 1 Answer

Any way to stop a build? 3 Answers

How to stop coroutine with parameters? 3 Answers

How do I keep an increment process continuous without the update function? 2 Answers

How do I use RESTful apis from Unity? 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