I have wp7 app whith two background threads: 1. Planing of time 2. Play different sound samples by planed time (Possible few samples in same time).
How to repeat this logic whith unity3d engine? Is it possible?
Unity will not allow you to access its APIs from any thread other than the main one; you can't use locking primitives to get around it.
You can use the standard .NET threading APIs to start threads that do not interact directly with the Unity API, though. You could calculate samples and buffers on an extra thread, but your main thread would have to call AudioClip.SetData to submit the calculated samples to Unity.
Note that since Unity 2018.1, the Job System has been introduced which allows certain kinds of computation tasks to be performed on background threads (for example, setting transform positions). The tasks that can be performed are being gradually opened up over time.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With