Just attempting to use Interlocked.Increment(ref threads) and it just hangs my game.
public static int threads;
...
Interlocked.Increment(ref threads);
Using System.Threads also.
I've moved it into the main thread and out of it, can't seem to get it to work anywhere. Is this just Unity causing this?
The .Net
Interlocked.Incrementdoesn't actually lock anything (at least it definitely doesn't for anint); it only ensures the increment happens atomically.Either it is not actually the change causing your problem or you've got another
Interlockedimported into your namespaces.