Unity 6 Web + C/C++ Multithreading --> JobWorkerCount = 5

In recent Unity 6.0 Web player builds, with “Enable Native C/C++ Multithreading” player setting checked, Unity.Jobs.LowLevel.Unsafe.JobsUtility.JobWorkerCount returns 5, and the profiler shows parallel job execution on those workers.

This is cool, but… is it usable for anything - would be great if it was. Specifically, since the problems with multithreading in Web sound like they’re primarily about the GC, if we have code that doesn’t access managed classes (i.e. jobs that compile with Burst on other platforms), is it currently possible to run those jobs on worker threads in a Web build?

This would make iterating on performance for web waaay nicer. Right now we’re writing C++ for multithreaded optimization on Web, if we could just use C# instead it makes testing in editor much easier. And saves us messing around with CMake. I’m still not sure whether CMake was industrial sabotage, an elaborate joke, or written by the Rust community as a prank on C++, but it’s done well.

1 Like

What you’re seeing is most likely a requirement for or side effect of enabling C++ multithreading.

The official word is still that C# multithreading is unsupported and will remain that way for the time being due to lack of browser support (and you’re correct it has to do with the GC and progress is being made).

Even if you were able to get some Jobs to run in parallel, you would simply have no idea about its limitations, current issues, future changes and what not. Writing your code against an API that isn’t even marked as experimental would be a serious strategic risk. It’s just not worth even thinking about it at this point. Wait for an official announcement. :wink:

Please stop replying when you have no useful technical contribution. We can all read roadmaps.

You didn’t mention you are following the roadmap.

So no, you cannot use Jobs on the Web as of Unity 6.0. I haven’t seen or heard of anyone succeeding to even create a Jobs-enabled web build no matter what. That’s technically accurate to the best of my knowledge.

1 Like

Hi,

Unfortunately, I can’t recommend you right now to use the Job System together with the “Enable Native C/C++ Multithreading” player setting for any production code.
As you already mentioned we currently don’t support C# multithreading. Aside from the .NET threading primitives this also includes the Unity Job System.
We are investigating our options for supporting C# multithreading and the Job System is part of that research.