Search Unity

Making a Unity player without graphics

Discussion in 'Scripting' started by Sombrero, Jan 31, 2018.

  1. Sombrero

    Sombrero

    Joined:
    Apr 18, 2013
    Posts:
    7
    Maybe it is a strange question, but is it possible to create progams in Unity without any graphical output? I want to build a command line program that uses Unity system and available GPUs to render frames, but not display them, just exports as files or send as network stream.
     
  2. StarManta

    StarManta

    Joined:
    Oct 23, 2006
    Posts:
    8,775
    The magic word to google is "headless" mode. It's mentioned here and a google search for that word will provide more information.
     
    Sombrero likes this.
  3. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    You can execute your game with the following command line options:

    -nographics -batchmode

    When you build for Linux you also have a headless mode check box, where it won't even link in all the graphics stuff into your build. If you do so you don't need to use the above command line options. Win/Mac don't have this checkbox though, so the graphics stuff is always linked in even if you aren't going to use it.
     
    Sombrero likes this.
  4. Sombrero

    Sombrero

    Joined:
    Apr 18, 2013
    Posts:
    7
    Thanks for the answerers. My problem is that if -nographics is used, I can not use GPU and the rendering engine at all. Or can I ? For example, is it possible to build a command line build that can make "screenshots" without actually using the screen? Example: the program runs silenty on a server, and when it receives a request from network, it sends back an image seen by the camera positioned by the client.
     
  5. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    6,338
    I don't actually know, but you could give it a go. Create a script that takes a screenshot at startup, run it in -nographics mode, check if the script shows anything.