Is there a way in code to have gpu or cpu do whats in the code?

I’m just trying to figure out if I can separate different parts of the code to spread it evenly across the processing power the computer has.

Shader code runs on the GPU, the rest runs on the CPU.

Unity supports DirectCompute which you may like to look into. DirectCompute requires DirectX 11 I believe, so that might limit your audience quite a bit. DirectCompute uses Compute Shaders, so it will take a bit of researching if you want to go that route.

Programming for GPU is quite different to programming for CPU. Most of your shader knowledge will apply, such as avoiding unnecessary branching, and is suitable to highly parallel and fairly independent tasks. Processing thousands of pixels in the same way, for example, is a great example of a highly parallel independent task if each pixel is processed independently of the others (one pixel doesn’t depend on output from another).

There is an excellent guide here: