Search Unity

Linux Headless Binary does not work

Discussion in 'Linux' started by econt, Jul 4, 2019.

  1. econt

    econt

    Joined:
    Apr 8, 2019
    Posts:
    52
    Hi,

    i have made a Linux binary which should create a folder for screenshots and create jpg's every second.
    After starting the binary it stops after creating the player.log and does not create the folder and no screenshot.
    (On Windows it works fine).

    Here is the console output:
    root@127:/home/ubuntu/LinuxHiRes_Headless# ./LinuxHiRes_Headless.x86_64

    Set current directory to /home/ubuntu/LinuxHiRes_Headless

    Found path: /home/ubuntu/LinuxHiRes_Headless/LinuxHiRes_Headless.x86_64

    Mono path[0] = '/home/ubuntu/LinuxHiRes_Headless/LinuxHiRes_Headless_Data/Managed'

    Mono config path = '/home/ubuntu/LinuxHiRes_Headless/LinuxHiRes_Headless_Data/MonoBleedingEdge/etc'

    Preloaded 'ScreenSelector.so'

    PlayerPrefs - Creating folder: /root/.config/unity3d/DefaultCompany

    PlayerPrefs - Creating folder: /root/.config/unity3d/DefaultCompany/LinuxHirRes

    Logging to /root/.config/unity3d/Editor/Player.log



    The player.log has only 1 line:
    Desktop is 0 x 0 @ 0 Hz


    The system where it runs on is a Ubunut (only commanline possible).


    How can I make this Linux binary make screenshots and save it to a .jpg like on win in -batchmode?

    thanks in advance
     
  2. PixelJ

    PixelJ

    Unity Technologies

    Joined:
    Nov 1, 2018
    Posts:
    216
  3. andrews_unity

    andrews_unity

    Unity Technologies

    Joined:
    Dec 11, 2015
    Posts:
    264
    @econt So headless mode is different than batchmode. Within the Linux build headless mode is actually compiling out the graphics libs, so it doesn't support any kind of rendering at the moment, the only way to get around this is run the standard player with batchmode like you do on windows.
     
    EirikWahl likes this.
  4. econt

    econt

    Joined:
    Apr 8, 2019
    Posts:
    52
    @andrews_unity - I was aware about the difference when doing the test. - It was definitly started in -batchmode on an Ubuntu (which is headless). - Does Unity need GLX, EGL oder X-Server to render out screenshots in batchmode?
     
  5. andrews_unity

    andrews_unity

    Unity Technologies

    Joined:
    Dec 11, 2015
    Posts:
    264
    @econt so based on your binary name you are using the headless binary vs the standard player binary. If you use the headless binary regardless of passing in batchmode or not you will not get any rendering support. This is because we actually do not even compile the rendering code for openGL or Vulkan into the binary.

    Now if you use the normal linux player, and then pass batchmode it will run in a "headless" mode but under the covers its still actually creating a window which means you will need x-server yes.
     
    EirikWahl likes this.
  6. econt

    econt

    Joined:
    Apr 8, 2019
    Posts:
    52

    The last information was the information that helped to understand the problem. - But when thinking about cloud gaming or large scale simulation if this mechanic will be changed in the future, because when several hundred instances of a unity game run on command-line-only (Linux) in the cloud would they all need to have an x-server for each instance that is running or will unity make a change that this is not necessary anymore?
     
  7. andrews_unity

    andrews_unity

    Unity Technologies

    Joined:
    Dec 11, 2015
    Posts:
    264
    @econt I think it depends on the workload, many servers don't need rendering so the standard "server" build option will work fine for most things, now of course if you need rendering then thats a different issue, and I can't speak the plans on when and if we will support that workload.

    But the headless option without rendering meets most server needs.