Unity SDK framerate




  • Official comment
    Scott Harper

    Hello, Lilian,

    I want to double-check some things first. The FoveInterface behaviours have two sets of methods for getting gaze values -- one which we lock to the current frame and poll again roughly every OnPreCull, and then a second set of methods which are intended to give you the actual current value from the C++ SDK at the time you call the method. These functions end in `_Immediate`, so `GetLeftEyeVector_Immediate()` and so forth.


    There's also a chance that you may be seeing problems because Unity runs all of its callbacks single-threaded. (In case you are newer to Unity's update loop, here is their documentation page with a really good diagram showing the flow: So while your FixedUpdate is running 1000 times a second, at some point it will break out and let the update and OnPreCull methods run. Inside OnPreCull, we perform a delay to sync the Unity render loop with the HMD's display (70Hz) which will likely be causing further problems.

    You may also not know that Unity's `Time.time` property is designed to tell you what you expect: That is, from within FixedUpdate, it always gives you the FixedUpdate interval, and so will always give you what you expect. A better test is to call Time.realtimeSinceStartup, which gives you a time based on your system clock and will change even within the same function. Perhaps even better is the Stopwatch class ( which is specifically designed for diagnostic timing reports.

    You definitely don't want to do coroutines, as they suffer from essentially the same problem as FixedUpdate.

    It is worth noting, however, that our SDK is fairly thread safe for most operations (we don't officially support multithreaded access at the moment, but for most uses it does quite well), and I have had good luck collected data using threads. Keep in mind that Windows's smallest granularity is 1ms, so when your thread sleeps or yields or is forced to the background there is a good chance that you'll miss more than 1ms of data. But for getting the latest eye gaze update it should be more than sufficient.

    Let us know if that works out any better for you.

    -- Scott

    Comment actions Permalink
  • Avatar

    Hi Lilian,


    I forgot to mention the other day but we have a data collection tool for Unity here:

    It looks as though you've got your one working now, which is great to hear.

    Seasons greetings!



    Comment actions Permalink

Please sign in to leave a comment.