Skip to main content
Search our knowledge base

Why should I use Threads instead of Coroutines?

Comments

3 comments

  • Andrew Burke

    I think calling any feature "Dangerous" will shy new users away from using it.

    Threads are not dangerous. Using them will not damage your computer.
    Threads are unpredictable when improperly implemented and being able to adequately convey that to new and intermediate users is necessary.

    1
  • NIKHIL PANDE

    here in this article the threads and the issues arising from the application of threading and synchronization has been dealt with clearly in the article, still many points are missing related to the coroutines which is the subject line. Still very very useful article.

     

    0
  • Petr Sorfa

    Threads were not supported in Unity WebGL until 2019.1, and I'm not sure if that actually supports .NET threads. So that might also be a suggestion to use coroutines instead of threads.

    I've noticed that threads have different limitations on different platforms, i.e. the maximum number of threads differ on iOS compared to PC and MacOS, so its best to keep threads to a minimum.

    The thread implementation does not seem stable under stress (Network, CPU and memory), particularly under iOS where iOS sometimes simply terminates the app if thread activity is high. It could also be related to a memory leak, resource hogging or something like that. After several hours of use, an iOS threaded app may tank with no warning.

    Using .NET networking with threads work alright for light network requests, but it seems that using the Unity networking API (WWW, etc..) may be a better option.

     

    0

Please sign in to leave a comment.