Search Unity

Monobehaviour Update in headless mode

Discussion in 'Scripting' started by Whippets, Nov 27, 2014.

  1. Whippets

    Whippets

    Joined:
    Feb 28, 2013
    Posts:
    1,775
    When running in -nographics mode, what does the Monobehaviour Update event use as a tick to run? Does it just tick as fast as possible, or is it limited somewhere, and if so, can this limit be set?
     
  2. OpticalOverride

    OpticalOverride

    Joined:
    Jan 13, 2013
    Posts:
    161
    I would assume Application.targetFrameRate would still apply, but I'd never thought about that before... If I were you, I'd make a quick application and maybe write the frame rate to a file or something. Change that Application.targetFrameRate static variable and see if it changes anything, that is if you can't get a quick answer from the community first.
     
  3. Whippets

    Whippets

    Joined:
    Feb 28, 2013
    Posts:
    1,775
    Thanks for that. Not come across targetFrameRate before. I'll run some tests :)
     
  4. OpticalOverride

    OpticalOverride

    Joined:
    Jan 13, 2013
    Posts:
    161
    No problem. Going to be messing with -nographics mode myself soon for a project so I'm sure I'll be going through dozens of similar questions myself :rolleyes:
     
  5. Whippets

    Whippets

    Joined:
    Feb 28, 2013
    Posts:
    1,775
    I've got my lobby server running headless without any problems. Solid as a rock running for over a month, with no memory leaks (so far, and not under heavy load).

    Now I'm sorting the AI for NPCs/MOBs, and am using Update() for movement, as my FixedUpdate is set to tick at 200ms. I just didn't want Update() running away at zillions of fps pointlessly. If I can peg it back to 50fps that would be great.

    Having run a few tests, yes, it can be pegged back to 50fps. It's not any guarantee of frame rate, but on average it's around 50 fps without going silly higher.

    Thanks for the ideas, it's been a real help :)
     
  6. OpticalOverride

    OpticalOverride

    Joined:
    Jan 13, 2013
    Posts:
    161
    Awesome, glad it helped!