So I am wondering, is System.threading safe to use on iPad2? I have used downloadFileAsync on the iPad with no issues, which makes a new thread to download the file. So it seems fine to me. But has anyone dug into use of System.threading pretty deeply? Is it safe to use, have you run into any issues?
I am wondering if I could do something like, put all Resouces.Load calls on a seperate thread, so that they’ll run on the second processor.
It is working fine for things where parallel access etc is allowed at all on iOS.
That being said, you don’t need to use the async download cause WWW on iOS goes to NSURLConnection which by definition is OS lowest level async and handled in likely the most optimal form for iOS devices at all (the .NET stuff has no mobile focus or optimization in the context of the present limitations there, its desktop .NET running on a mobile with all its implications)
Question is what you want to thread as unity itself can not be thread accessed
EDIT: Threaded resources already exist, thats what Asset Bundles and loadasync is for
Threading works, but Unity doesn’t enforce any thread safe calls.
This means that when using a new Thread you need to avoid 99% of all UnityEngine calls. That being said it’s great for processing heavy operations. We use Threading for custom Networking Calls and to stream from Network .Zip to File(s) without causing heavy hitches to the framerate.
You can’t use Resources.Load(), but you can use FileStream and your own file formats to load and parse in a thread, and once completed instantiate the object back on the Main Thread.
Also, if this is for Networking be aware that .NETs Networking won’t wake up a 3G connection. It can fall asleep after a specified timeout, and will shut down your networking. NSURLConnection can keep it awoken, and if you keep using it it won’t fall asleep, just be aware that after a set amount of inactivity you may need to call an NSURLConnection call to get 3G up again.