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 Noah Dyer · Feb 18, 2015 at 10:28 PM · eventsthreadsdelegatedelegates

Can't include System.Threading.Tasks

I'm trying to do asynchronous web calls outside of the www class using httpwebrequest. At the end of my asynchronous web requests, I need to tell unity to do stuff with the data, but unity doesn't like it because I'm calling from off the main thread. My intention was to create a TaskScheduler on the main thread, tell the web request about it, and have the web request schedule it's tasks on the main thread when it completes. But intellisense doesn't recognize System.Threading.Tasks (it does recognize System.Threading), and therefore I get compile errors if I try to create a TaskScheduler.

Open to solutions to instantiate a Task Scheduler, or alternatives for getting back to the main thread once I'm off it.

Comment
Add comment · Show 1
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 Noah Dyer · Feb 26, 2015 at 09:54 PM 0
Share

Sorry I missed your comment earlier! It was helpful :)

3 Replies

· Add your reply
  • Sort: 
avatar image
3

Answer by Kitty001 · Oct 02, 2017 at 10:37 PM

I just had to solve this. Now threading.Tasks are included in Unity 2017. Download the latest Unity, 2017, go to Edit/ Project Settings/ Player > scroll down and select to 'Configuration and set Run Time API as "Experimental (.Net 4.6 Equivalent)."

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 erics_vulcan · Oct 04, 2017 at 05:10 PM 1
Share

I'm running Unity 2017.2 and have the runtime set to the experimental .Net 4.6 like you mentioned. $$anonymous$$y build target is set to Universal Windows Platform. Unity won't recognize System.Threading.Tasks. It finds System.Threading, but not the Tasks namespace. Consequently, calling Task.Run() results in the red squiggly. Any tips?

avatar image
1

Answer by hexagonius · Feb 20, 2015 at 04:18 PM

Maybe this helps, just found it for a similar question:

http://answers.unity3d.com/questions/357033/unity3d-and-c-coroutines-vs-threading.html

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 youblistermypaint · Jun 09, 2016 at 02:50 PM

It's because Unity is stuck on a older version of Mono, 3.5 I believe. Tasks were introduced in 4.

It may be possible to use the backported version of the Tasks library in Unity. I can't personally vouch for this approach as I haven't tried it myself.

  • Library

  • Thread on using the Library in Unity

Comment
Add comment · Show 4 · 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 Flaring-Afro · Jun 09, 2016 at 03:36 PM 0
Share

It's on $$anonymous$$ono 5.9 now, if the OP can upgrade without issues...

Unity Roadmap

Edit: Unless it's still .NET 3.5?

avatar image youblistermypaint Flaring-Afro · Jun 09, 2016 at 03:39 PM 0
Share

Is it? 5.3 is not, is the 5.4 beta on it? I don't see it on the roadmap.

avatar image Dave-Carlile Flaring-Afro · Jun 09, 2016 at 03:43 PM 1
Share

$$anonymous$$onoDevelop and the underlying $$anonymous$$ono .NET implementation are two different things.

avatar image Flaring-Afro Dave-Carlile · Jun 09, 2016 at 04:13 PM 0
Share

Yeah, i realized when I thought bout how 5.9 seemed too high. :/

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

26 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 avatar image avatar image avatar image

Related Questions

Delegates/Events across threads 0 Answers

Help to understand events and delegates (Game Manager) 2 Answers

How to unsubscribe from InputSystem event properly 0 Answers

Subscribe to an event when the application is loaded 3 Answers

Unity Events - Subscribe and Unsubscribe Odd Behavor 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