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
5
Question by TieSKey · Apr 20, 2011 at 01:27 AM · librarysupportcollectionsconcurrent

Is System.Collections.Concurrent or equivalent supported?

I need to use a Concurrent Dictionary or at least some kind of non blocking concurrent collection, is this supported? I get a "namespace name Concurrent' does not exist in the namespaceSystem.Collections'" error on Unity.

If not, is there an alternative library?

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

2 Replies

· Add your reply
  • Sort: 
avatar image
-1
Best Answer

Answer by Bunny83 · Apr 20, 2011 at 01:56 AM

Just take a look at the Mono compatibility page. It's not in the list. Why do you need thread safe collections? You can of course start threads but in Unity it's not that common because the whole API is not thread safe.

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 TieSKey · Apr 20, 2011 at 06:04 PM 0
Share

Oh, I was looking to the mono compatibility page on mono's site, not unity's, my bad. I am just experimenting with the very basis of a "socket server", but after asking, I realized I don't need Unity at all to make the "server" part so it doesn't matter now :P

avatar image Joshua P. R. Pan · Jan 29, 2016 at 03:03 AM 0
Share

The Concurrent Dictionary may be necessary if you want to Serialize Dictionary. And since Unity separate the display thread and modify thread, you might get Race Condition.

For example, you display serialize dictionary on inspector and with an "Add Element" button. You may get IndexOutOfRangeException if you add new dictionary element by press that button.

avatar image
5

Answer by snacktime · Aug 19, 2013 at 05:21 AM

What do you mean why do you need thread safe collections? The unity api not being thread safe is no reason to not use threads in unity, it just means don't use their api outside of the main thread. Using thread safe collections or queues to pass information between the main thread and your own threads is perfectly acceptable, given you know what you are doing.

I have a feeling they left it out to discourage people who don't know what they are doing from using threads. But that just forces us to use primitive synchronization which sucks.

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 Simon-O · Aug 31, 2015 at 02:46 AM 0
Share

Couldn't agree more. I specifically want thread safe collections to pass callbacks to the main thread to invoke. Some bits of Unity are truly excellent (eg shaders), but others (like this) feel half baked.

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

2 People are following this question.

avatar image avatar image

Related Questions

BurgZurgArcade Tutorial 3 Answers

Best way to store large amounts of data for random generation 1 Answer

How does one get support? 2 Answers

Dual graphics cars support? 2 Answers

Real-Time Ambient Occlusion 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