Compute Shaders in a Headless Server

Hello,

I’m about to start developing dedicated servers for my game’s upcoming expansion. I’ve started some initial experimentation, and immediately ran into the problem I expected to have: compute shaders do not work in a headless build. This is a major problem because our damage model relies heavily on compute shaders for the armor damage position tracking.

I can’t be the only person who has ever needed to do compute shader work in a headless server, but I can’t find any resources on a way to accomplish this. Googling for “unity compute shader headless instance” turns up less than two pages of irrelevant results. Is it at all possible or am I going to need to find another solution?

I’m on Unity 2020.3.19f1, but willing to upgrade if necessary.

The “headless” part means the build doesn’t do any sort of graphics, therefore not using or interacting with the GPU. A compute shader runs exclusively on the GPU, therefore, it’s a given that you cannot run them in a headless build.

You’ll either need to use non-headless builds running on machines with actual GPUs in them or rework your damage model to run on the CPU using jobs+burst or something like that.

A third option would be to use a third party graphics library that you can do compute through and pass the results into your systems.
You can get the native graphics pointers from Unity’s API to use.

But jobs is a great fit too for this most likely.