We're trying to write a server-side app in Unity Pro. Part of its function is to generate images and serve them to a browser. This works fine if the app is started the regular, windowed way. Ideally, we'd like the app to run headless. The problem is, as far as I understand, Unity's "-batchmode" flag disables the rendering pipeline completely.
Is there a way to run Unity in headless mode whilst retaining its rendering capabilities?
Perhaps this commandline might work? It's the reference DX renderer which MIGHT work without a gpu since it's pure cpu, although I doubt it :)
"-force-d3d9-ref (Windows only)
Make the game run using Direct3D's "Reference" software renderer. DirectX SDK has to be installed for this to work. This is mostly useful for building automated test suites, where you want to ensure rendering is exactly the same no matter what's the graphics card."
This totally works, however I found you have to ensure you are using a forward renderer, and force the camera to render prior to running a screen capture.
screenShot.ReadPixels(new Rect(0, 0, resWidth, resHeight), 0, 0);
I don't believe it's possible to run a standalone player in batch mode without automatically disabling the rendering. As per the documentation:
Run the game in “headless” mode. The game will not display anything and won’t accept user input. This is mostly useful for running servers of networked games.
Looks like you're going to either have to think up another solution, or run the game normally unfortunately.