Home Forums Legacy SDKs Unity: DllNotFoundException: TobiiGazeCore64.dll

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #2463
    Dieter Merkel
    Participant

    Hi,

    i am trying to build a program with Unity and GazeSDK.

    I downloaded the Gaze SDK for .NET and copied the 64bit dlls into my unity-project root folder. But when i try to run the program in the editor i get the error:

    DllNotFoundException: TobiiGazeCore64.dll
    Tobii.Gaze.Core.EyeTrackerCoreLibrary.GetConnectedEyeTracker ()
    TobiiData.Start () (at Assets/Tobii/TobiiData.cs:13)

    Here is the Code:

    using UnityEngine;
    using System;
    using System.Threading;
    using System.Collections;
    using Tobii.Gaze.Core;
    
    public class TobiiData : MonoBehaviour {
    
    	private IEyeTracker tracker;
    	private Thread thread;
    	private static GazeData lastGazeData;
    
    	void Start () {
    		Uri url = new EyeTrackerCoreLibrary().GetConnectedEyeTracker();
    		tracker = new EyeTracker (url);
    		tracker.EyeTrackerError += EyeTrackerError;
    		tracker.GazeData += EyeTrackerGazeData;
    		thread = CreateAndRunEventLoopThread(tracker);
    		tracker.Connect();
    		tracker.StartTracking();
    		#if UNITY_EDITOR
    		UnityEditor.EditorApplication.playmodeStateChanged = closeDLL;
    		#endif
    	}
    
    	#if UNITY_EDITOR
    	void closeDLL(){
    		if ( !(UnityEditor.EditorApplication.isPlaying) && !(UnityEditor.EditorApplication.isPaused)){
    			tracker.StopTracking();
    			tracker.Disconnect();
    			if (thread != null)
    			{
    				tracker.BreakEventLoop();
    				thread.Join();
    			}
    		}
    	}
    	#endif
    
    	/***************************************************************
    	 * tobii functions to use the eye tracker via the eye gaze sdk *
    	 * *************************************************************/
    	
    	private static string CoreLibraryVersion()
    	{
    		using (var lib = new EyeTrackerCoreLibrary())
    		{
    			return lib.LibraryVersion();
    		}
    	}
    	
    	private static Thread CreateAndRunEventLoopThread(IEyeTracker tracker)
    	{
    		var thread = new Thread(() =>
    		                        {
    			try
    			{
    				tracker.RunEventLoop();
    			}
    			catch (EyeTrackerException ex)
    			{
    				print("An error occurred in the eye tracker event loop: " + ex.Message);
    			}
    			
    			print("Leaving the event loop.");
    		});
    		
    		thread.Start();
    		
    		return thread;
    	}
    	
    	private static void PrintDeviceInfo(IEyeTracker tracker)
    	{
    		var info = tracker.GetDeviceInfo();
    		print(string.Format ("Serial number: {0}", info.SerialNumber));
    		
    		var trackBox = tracker.GetTrackBox();
    		print(string.Format ("Track box front upper left ({0}, {1}, {2})", trackBox.FrontUpperLeftPoint.X, trackBox.FrontUpperLeftPoint.Y, trackBox.FrontUpperLeftPoint.Z));
    	}
    	
    	private static void EyeTrackerGazeData(object sender, GazeDataEventArgs e)
    	{
    		lastGazeData = e.GazeData;
    	}
    	
    	private static void EyeTrackerError(object sender, EyeTrackerErrorEventArgs e)
    	{
    		print("ERROR: " + e.Message);
    	}
    }

    The error line is:
    Uri url = new EyeTrackerCoreLibrary().GetConnectedEyeTracker();
    in the Start function.

    Anyone know what i am doing wrong ?

    Regards

    #2464
    Dieter Merkel
    Participant

    Solved:

    Do not know why, but it seems that Unity has some problems with the 64 bit version (or i forgot to set some settings ? anyway ).
    If someone has the same problems:
    – use the 32 bit dlls
    – copy TobiiGazeCore32.dll into the project root folder
    – copy Tobii.Gaze.Core.Net.dll into assets/plugins folder

    That worked for me.

    Edit: Oh and make sure there are no _just_in_case_ dlls of 64 version in your project.

    #2465
    Anders
    Participant

    Hi Dieter,
    great to hear that you could sort it out and thanks for the advice.

    #4050
    Ahmad
    Participant

    I did all of those steps, still get the dll exception.

    #4157
    Grant [Tobii]
    Keymaster

    Hi Ahmad,

    We generally recommend that if you are intending to work with the Unity engine that you use
    the EyeX SDK.

    Unless you have reason to use the GazeSDK, I would encourage you to try instead with the EyeX SDK
    and let us know if your issues persist.

    #5268
    Ahmad
    Participant

    I want to find the distance from the player eyes to the screen. GazeSdk can give such info for me only.

    #5438
    Alex [Tobii]
    Participant

    Hi!

    Check EyePositionDataStream from EyeX SDK for .NET (not the one for Unity)
    It provides a stream of eye position data, that is, eye positions in 3D space.

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.