Here is the situation: I got several objects of one prefab on scene, each object is trying to communicate with one global array (or list) of points in its own Update (check if it contains some point; if it is, then generate new point; if it’s not, then add this point to the end of array).
I got a little mess in my head about it. I know Unity is single-threaded, that should mean updates runs sorta like this (pseudo-code):
void MakeTheFrame()
{
...
object1.Update(); // access to global array
// wait for completion
object2.Update(); // access to global array
// wait for completion
object3.Update(); // access to global array
// wait for completion
...
}
And that means access to global array is consecutive and thread safe. Am I right on this point?
And what about the same situation in Coroutine implementation?
Where I can read more about things like that and how Unity code actually works inside?
Hilfor
2
Yes you are right. You can find more info here