I have three lists; player2, player3 and player 4, for example I want to be able to loop through threads where player2 in this case should increase by 1 every time. How do i reference this and make sure that it will still operate in the way it was intended, or is it even possible?
var thread = new Thread(() => { player2 = playerai(“Player” + mult.ToString()) });
I am no expert on Threading, to say the least, but I do know that Unity’s thread is notthread-safe and cannot be accessed from other threads. You maybe should consider if 'new’ing a thread is the best option here or if a coroutine would be more appropriate.
"*Unity’s Api is NOT thread safe so it can’t be used from another thread. Unity have also implemented a thread-check to prevent you from trying to use it from another thread
…
You can use your own threads for calculating something in the background or communicate with a native code plugin but not to interact with Unity. "*