Job structs can’t contain managed types like string
, class
instances, or delegates. This is currently a pain as a lot of the Unity API relies on these and so we’re forced to deal with them. Today we’ll talk about how we can use managed types in our jobs to bridge the gap.
Posts Tagged job
Normally Burst-compiled jobs can’t use managed arrays, but there’s an exception for static readonly
fields. This comes with several dangers, which we’ll explore today.
With each new release of Unity, more and more job-safe APIs are added. Today we’ll look at the new ones and learn how we can move even more code into high-performance C# jobs.
Unity’s C# job system is a powerful tool, but it can be difficult to understand how various jobs, their dependencies on each other, and the data they use all work together to accomplish a task. Today we’ll create a little tool that visualizes and generates job graphs so it’s much easier to understand them and easier to build larger, more powerful graphs.
Unity 2018.3 brings us even more thread-safe APIs that we can call from the C# job system. Today we’ll look at a systematic way to find them all so we know what’s safe to use and what’s not.
Last week’s article introduced two new native collection types: NativeIntPtr
and NativeLongPtr
. These were useful for both IJob
and IJobParallelFor
jobs, but performance was degraded in IJobParallelFor
. Today we’ll remedy that, explore some more aspects of Unity’s native collection and job systems, and learn more about CPU caches along the way.
Today we’ll add two new types to the Native Collections suite: NativeIntPtr
and NativeLongPtr
. We’ll make them usable with both IJob
and IJobParallelFor
and explore some new features Unity’s native container system along the way.
Two weeks ago we tested the performance of the async
and await
keywords plus the C# Task
system against Unity’s new C# jobs system. This tested the usual combination of async
and await
with the Task
system, but didn’t test the Task
system directly against Unity’s C# jobs system. Today we’ll test that and, in so doing, see how to use the Task
system without the async
and await
keywords.
Unity 2018.1 brought us two asynchronous code systems. First, there’s C# 5’s async
and await
keywords in conjunction with the Task
and Task<T>
types. Second, there’s Unity’s own C# jobs system. There are many differences, but which is faster? Today’s article puts them to the test to find out!
Last time in the series we encountered and overcame a host of esoteric issues on our path to a better understanding of Unity’s native collection system. This week we’ll continue on that journey and grapple with even more challenges in this new, unexplored area of Unity.