Unity 2018.1 shipped with just one true native container: NativeArray<T>
. Now Unity 2018.2 has been released and there is still just the one native container. We’ve seen how to implement more, but never wrote much more than a proof of concept. Today we’ll begin implementing NativeLinkedList<T>
as an example of a native container for a very well known, simple data type. The result is available on GitHub for any project to use.
Archive for category Unity
Unity provides IJob
, IJobParallelFor
, and IJobParallelForTransform
and it turns out these are written in C# so we can learn how they’re implemented. Today’s article goes through each of them so we can learn more about how they work and even see how we can write our own custom job types.
My Job System Tutorial listed many Unity APIs accessible from C# jobs, but the list was incomplete. Today I’ll add on to the list with some newly-released 2018.2 features as well as some powerful 2018.1 features that were left off of the last article. Many of these aren’t documented in Unity’s release notes. Read on to learn more about what you can do with C# jobs!
LINQ’s CPU performance is quite poor, but how is it with memory? Does every LINQ function always create tons of garbage for the GC to collect, or are there exceptions that aren’t so bad? Today’s article tests out lots of LINQ functions to find out!
Many Unity programmers misunderstand FixedUpdate
because it seems so basic. Usually it behaves in the simplistic way it’s thought to work, but there are important exceptions that are often forgotten. Today we’ll take a closer look at FixedUpdate
to get a better handle on how it works and learn to use it correctly.
Programming in high-level languages like C# often presents the illusion that the CPU is only capable of a few primitive operations like “add,” “multiply,” “push,” “pop,” and “move.” After all, those are the primitive operations that we write all of our C# code with. The reality is quite different. Modern CPUs have hundreds of instructions for tons of special-purpose operations. Entire algorithms in C# are built right into the CPU and can be executed with one instruction. Today we’ll look at some of these exotic instructions as a reminder of what CPUs can really do and see how we can tap into this potential.
The new Job System debuted recently in Unity 2018.1 and began the process of changing how virtually all Unity scripts will be written. In conjunction with the forthcoming ECS and Burst compiler, the old MonoBehaviour
-based programming paradigm will eventually be replaced. Today’s article is a tutorial for how to get started learning the new way of writing Unity scripts.
The C++ Scripting series continues today by going over some internal improvements that don’t add any features, but make the existing system more robust. We’ve lucked out in a couple of areas and today we’ll take the opportunity to fix them and learn about some inner workings of C++ and C# along the way.
Today we’ll look at the C++ code that IL2CPP outputs when we use iterator functions (those that yield
), switch
statements, and using
blocks. What are you really telling the computer to do when you use these C# features? Read on to find out.
(Website Announcement: check out the new tags page to find articles by topic)
NativeArray<T>
is a new type introduced recently in Unity 2018.1. It’s like List<T>
except it’s backed by an unmanaged array instead of a managed array. It’s also a struct instead of a class. This means it creates no garbage for the GC to later collect. That’s the surface level description, but today we’ll go in depth to find out how it really works and learn some interesting facts along the way.