How to run jobs using ComponentDataFromEntity in parallel

ComponentDataFromEntity<T> is one of the most commonly used API in Unity's Entities package (ECS). At least in our case. It's basically like Dictionary<Entity, T> where T is an IComponentData. You can lookup any component as long as you have the entity owner. You can get a ComponentDataFromEntity<T> for any T in any sytem. The most … Continue reading How to run jobs using ComponentDataFromEntity in parallel

The different lists allowed in IComponentData

Unity's ECS is very different in that it requires a subset of C# if you want to take advantage of the Burst compiler. This subset was termed High Performance C# (HPC#). For the components part of ECS, only structs are allowed that are composed of blittable types. You can't have reference types like classes. public … Continue reading The different lists allowed in IComponentData

Getting Started with Blob Asset

Blob asset is a concept used in Unity's DOTS. Basically, it's an asset that's stored in unmanaged memory that can be accessed inside components. The term "asset" here does not mean asset in the traditional sense like a prefab, texture, 3D model, audio clip, etc. The term is used to mean data. It could be … Continue reading Getting Started with Blob Asset

A Multithreaded Sorting Attempt

In my previous post, NativeArray.SortJob<T>() ended up running slow because it's not being Burst compiled in the PC build. I've discovered that this is a known limitation. Generic jobs that are invoked inside generic methods can't be Burst compiled. A known trick is to "mention" the jobs with concrete types so that the jobs will … Continue reading A Multithreaded Sorting Attempt

NativeArray.SortJob() is fast… or is it?

While I was making a framework of rendering sprites using Compute Buffers, I was thinking of what sorting algorithm to use to sort sprites (say render from top to bottom). I'm using a Burst compiled Quicksort in my mesh based sprite rendering system. This is already good but maybe I could do better. Since Unity … Continue reading NativeArray.SortJob() is fast… or is it?