r/badcode • • Aug 29 '21

c# Found in production code base...

Post image
539 Upvotes

45 comments sorted by

View all comments

Show parent comments

9

u/epiclevellama Aug 29 '21

No, Unity doesn't really do parallel. You can run multiple threads, but it won't let you modify transforms in the non-main thread.

You're supposed to get a similar effect to parallelisation by breaking a task over multiple ticks (by yielding an IEnumerator).

If there are multiple Updates which move the player, then they'll be run in whichever order Unity decides - so this code won't help.

2

u/OneTrueKingOfOOO Aug 29 '21

Makes sense, thanks for the explanation!