Search Unity

Headless Mode, displaying text on console screen as well as log file...

Discussion in 'Linux' started by TheUKDude, Feb 22, 2017.

  1. TheUKDude

    TheUKDude

    Joined:
    Jul 27, 2013
    Posts:
    72
    Hello All

    I am creating a dedicated server to be run on one of our Linux Servers in Headless Mode, but I am needing to be able to output what its doing on the console screen and also debug information in its log file.

    Like the following being displayed on the console screen:
    Starting GAME_NAME on port PORT_NUMBER
    • Linking up with Realm Manager.
    • Setting Realm Status as CLOSED_DEV

    As well as having the normal log file created.

    Is this possible, if so can you point me to the right direction.

    Regards

    Paul
     
  2. Tak

    Tak

    Joined:
    Mar 8, 2010
    Posts:
    1,001
    There's not a straightforward way to do this, since Unity redirects stdout to its log file.

    I'd recommend that you create your own log to a separate file, then tail that file on the console when running the server.
     
  3. TheUKDude

    TheUKDude

    Joined:
    Jul 27, 2013
    Posts:
    72
    Thanks for the reply.

    I ended up starting to write my own server network code so that it runs on Linux which works fine so far, was still shocked that a unity application for Linux (Headless Mode) was taking 14% of the CPU doing nothing.

    So for my Server I won't be using Unity, which makes sense to me due to it had loads of stuff that I wouldn't be using.
    I will be using Unity for my Client along with my own TCP Network Client which uses Threads, Queues and Handlers etc.

    Paul
     
  4. Tak

    Tak

    Joined:
    Mar 8, 2010
    Posts:
    1,001
    What was the target framerate?
     
  5. TheUKDude

    TheUKDude

    Joined:
    Jul 27, 2013
    Posts:
    72
    Erm that was with the vertical Sync off.

    Paul
     
  6. Tak

    Tak

    Joined:
    Mar 8, 2010
    Posts:
    1,001
    Vsync won't have any effect with a headless player - if you don't set Application.targetFramerate, it will fall back to the default (which is something like 1000 FPS, if I recall correctly). (The headless player still uses a "normal" player loop despite not doing any rendering.)