CesiumGS / CesiumGS/cesium-unity
Use Unity Job System instead of System.Threading
- Dominant language
- C#
- Stars
- 535
- Forks
- 132
- Avg merge
- 6h 45m
- Merged PRs (30d)
- 1
Description
Following up with a new issue related to https://github.com/CesiumGS/cesium-unity/issues/258.
C# System.Threading ThreadPool does not seem to play nice in Unity. On Quest for example, ThreadPool has 8 worker threads (Environment.ProcessorCount is 8), which is wrong. On Quest the app only gets access to 3 of the 8 cores. ThreadPool.SetMaxThreads does not allow setting the worker count to less than ProcessorCount sadly. Having 8 CPU intensive threads during 3DTile processing causes frame drops even if the Main Thread is higher priority than the worker threads.
It looks like Unity's Job system may be a better choice for running Cesium tasks:
https://docs.unity3d.com/2022.2/Documentation/Manual/JobSystemOverview.html
Any thoughts on using that instead?
Contributor guide
Assessment
This issue has not been assessed yet.