How to disable Screen Selector for BuildPipeline?

I am trying to build my server from an editor script.
I need to disable screen selector otherwise the server will crash on my server with no graphical output.
I tried setting it in PlayerSettings but it didn’t seem to affect the build.
Is there a way to disable screen selector for BuildPipeline.BuildPlayer?

My server is a linux cloud server if that helps…

Are you passing ‘Unity - Scripting API: BuildOptions.EnableHeadlessMode’ as a build option to that function? Does that still bring up the screen selector?

Ok, passing Enabled Headless Mode didn’t help.

Did you test building this through the build window and did that work? To confirm if it’s the build rather than your code for your editor script. Noting that using BuildPipeline.BuildPlayer is independent of this window.

If it is your script that is the problem, can you show us your editor script?

Hi, eventually it worked. I accidently passed Headless Mode to the wrong build(I build to more than one target platform).

So I’m slowly building out a scriptable object that can be created in your assets folder and used to build for different targets. You can also extend from it to have custom stuff for a specific game build process.

I mostly need to beef up the editor/visuals for it right now (get it a bit more inline with the unity build window). But it for the most part works as long as you know what BuildOptions go with what platform.

Anyways, this way you get a nice visual place to see what each build process for each platform has specifically for it.

It’s build into my framework I’ve been building over the years. But you can take a look at it to get a nice starting point. Most if it can be ripped out of my framework relatively easily.

An example of how it looks: