NativeLinkedList<T>: Part 2

Tags: , ,

Continuing from last time, today we’ll greatly expand on the fledgling NativeLinkedList<T> that we started last time. By the end of the article, we’ll have a useful native collection available to us!

Read the rest of this article »

No Comments

NativeLinkedList<T>: Part 1

Tags: , ,

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.

Read the rest of this article »

No Comments

How Unity’s C# Job Types Are Implemented

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.

Read the rest of this article »

No Comments

Do More With C# Jobs

Tags: , ,

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!

Read the rest of this article »

2 Comments

Just How Much Garbage Does LINQ Create?

Tags: , , ,

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!

Read the rest of this article »

1 Comment

How FixedUpdate Works

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.

Read the rest of this article »

1 Comment

LINQ Performance Update

Tags: , ,

It’s been over three years since the last article on LINQ performance. That was all the way back in the Unity 5.0 days using Mono as a scripting backend. Today we’ll update that article’s test with Unity 2018.1 and IL2CPP to see how LINQ fares these days. Is it any better? Read on to find out!

Read the rest of this article »

1 Comment

Exotic CPU Instructions

Tags: , ,

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.

Read the rest of this article »

4 Comments

Job System Tutorial

Tags: , ,

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.

Read the rest of this article »

2 Comments

C++ Scripting: Part 31 – Init Improvements

Tags: , ,

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.

Read the rest of this article »

2 Comments