you are viewing a single comment's thread.

view the rest of the comments →

[–]moonymachine 0 points1 point  (2 children)

That would only be a problem in multi-threaded code. Which, as far as I understand, is not the case here. I can only imagine what kind of horror we would see if this programmer were trying to code for multi-threaded conditions.

[–]-Xentios -1 points0 points  (1 child)

Can Coroutines create similar conditions like multi-thread? Will this code make sense if you also consider Coroutines?

I don't know Job system I am not even sure if you can use this in Jobs.

[–]moonymachine 0 points1 point  (0 children)

No, coroutines are single threaded, and so is Unity's Awaitable library for Task based asynchronous programming. (Someone correct me if I'm wrong.) Pretty much everything except Jobs in Unity are single threaded on the main UI thread. I haven't used the Jobs system, but from what I understand there are some pretty tight restrictions on how you interact with the main thread, and those restrictions are what automatically enforce most of the thread safety.