Home › Forums › Game Integration › [Solved] Unity 5 DisplaySize and ScreenBounds are invalid › Reply To: [Solved] Unity 5 DisplaySize and ScreenBounds are invalid
When you say that you are trying to “compute the position on the screen” I suspect that the data you really want is Gaze Point data. A
GazePoint is the point on the screen where the user is looking, and is a point position aggregated of gaze data from both eyes. The GazePoint class has properties for getting the point in Screen, Viewport and GUI coordinates.
The Eye Positions are the positions of the eye balls in 3D space, the positions are relative to the screen center but it does not say anything of where on the screen the user is looking. This data is also quite hard to make use of since it does not provide a stable signal. We currently consider it as an experimental data stream that should be used with caution.
Now, for the ScreenBounds and DisplaySize state values returning invalid values – this is actually expected behavior the first time the values are asked for. The call to the underlying API is asynchronous, and we have to wait for a callback before the values can be updated correctly. In your code snippet above, you only make one call and in the Awake method, where the eye tracking host has just barely been initialized. Code that depend on the values of these states need to be placed in the Update loop or some other method that is called repeatedly, and have a check for the values being valid before they are used.
I notice you are using the 1.7 Unity SDK. I would like to encourage you to move to the recently released Tobii EyeTracking SDK for Unity – v2.0. It has a lot of improvements and also comes with online Manual and Scripting Reference documentation. It is available on the Downloads page.
I hope this gets you going with your project, and I look forward to seeing what cool stuff you build with the SDK!