Jump to content

Playnary

Verified Members
  • Posts

    5
  • Joined

  • Last visited

Posts posted by Playnary

  1. On 1/5/2021 at 10:54 AM, imarin18 said:

    Dear @jboss

    Thank you very much for your response.

    I think your understanding is correct. We need to remember that Unity playing does not always work along with eye tracking. In your script posted previously, you wrote the code below. This stops only the playing of Unity, not eye tracking. Thus, if you want to stop the eye tracking in parallel, one of the workarounds would be to use UnixTime (i.e. SaccadeEndTime) as a trigger to stop the eye tracking, as designed in the GitHub page: https://github.com/MotorControlLearning/SaccadeVR-mobile.

     if (Application.isPlaying)
            {
                Application.Quit();
            }

    Best regards,

    imarin18

    Late to the party, but I've seen this issue come up in several threads here (and had it myself):

    The SaccadeVR project actually does a neat workaround that works for most use cases and a freeze because of the ongoing while/for loop in the eye tracking:

    You can hand over every end condition you might want to the loop in the separate callback thread through an intermediate function. In my case, it's a simple bool:

        static bool GetEndCondition()
        {
            return isQuitting;
        }


    that static bool is set OnApplicationQuit
     

       private void OnApplicationQuit()
        {
            isQuitting = true; 
    	}


    and the intermediate function called within the loop:

    while (FrameCount < MaxFrameCount)
            {
                CppFrameCount++;
    
                // Break loop when necessary so the Callback does not freeze Unity, e.g. when quitting the application
                bool endCondition;
                endCondition = GetEndCondition();
                
                if (endCondition) // if needed compare the ending condition e.g. with the FrameCount or Unix time here
                    break;
                                      
                
    		// do stuff
                                      
     	}

     

    Voilà. No more freeze on closing the Runtime & Stopping the Editor.

  2. On 2/10/2021 at 2:23 AM, Corvus said:

     

    Unity Sample Code


    Hi everyone - I get around 230hz or 4-5ms. That is without rendering from Unity though, I only use it to extract data. (Output is coming from a separate application)

    Specs:

    Win 11 / Unity 2020.2.4
    Intel(R) Core(TM) i7-10700 CPU @ 2.90GHz   2.90 GHz
    32,0 GB
    RTX 3070

    Something peculiar though when I use the OP's code - editor and runtime crash on OnApplicationQuit / when I stop it. Full freeze. The only thing that is logged before is:

    Quote

    [XRInputSubsystem] A device disconnection with the id 1 has been reported but no device with that id was connected.

    Anyone having a similar issue?

×
×
  • Create New...