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.Increment doesn't actually lock anything (at least it definitely doesn't for an int); it only ensures the increment happens atomically.
Either it is not actually the change causing your problem or you've got another Interlocked imported into your namespaces.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With