Home › Forums › Software Development › eyeX framework on Unity 5 › Reply To: eyeX framework on Unity 5
Hello Tim and Thomas,
I’m currently working on fixing the Tobii EyeX Unity SDK to be fully compatible with Unity 5 out of the box.
In the meanwhile, the following workaround should work.
1. Start Unity and convert your old project (4.6) to 5.0.
2. Close Unity and MonoDevelop/VS
3. Create the folder Assets/Plugins/x86
4. Create the folder Assets/Plugins/x86_64
5. Remove any content in the root of Assets/Plugins
6. Copy Tobii.EyeX.Client.Net20.dll
from the folder Assets/Standard Assets/EyeXFramework/lib/x86
to Assets/Plugins/x86
7. Copy Tobii.EyeX.Client.dll
from the folder Assets/Standard Assets/EyeXFramework/lib/x86
to Assets/Plugins/x86
8. Copy Tobii.EyeX.Client.Net20.dll
from the folder Assets/Standard Assets/EyeXFramework/lib/x64
to Assets/Plugins/x86_64
9. Copy Tobii.EyeX.Client.dll
from the folder Assets/Standard Assets/EyeXFramework/lib/x64
to Assets/Plugins/x86_64
10. Remove the folder Assets/Standard Assets/EyeXFramework/lib/x86
11. Remove the folder Assets/Standard Assets/EyeXFramework/lib/x64
12. Remove the file Assets/Standard Assets/EyeXFramework/lib.meta
13. Remove the file Editor/EyeXClientLibraryDeployer.meta
14. Modify the file Editor/EyeXClientLibraryDeployer.cs
to look like this:
//-----------------------------------------------------------------------
// Copyright 2014 Tobii Technology AB. All rights reserved.
//-----------------------------------------------------------------------
using UnityEngine;
using UnityEditor;
using System;
using System.IO;
using UnityEditor.Callbacks;
/// <summary>
/// Editor class for deployment of the Tobii EyeX Client library and .NET binding
/// to where they need to be.
/// </summary>
[InitializeOnLoad]
public class EyeXClientLibraryDeployer
{
private const string ClientLibraryFileName = "Tobii.EyeX.Client.dll";
private const string Source32BitDirectory = "Assets/Plugins/x86";
private const string Source64BitDirectory = "Assets/Plugins/x86_64";
/// <summary>
/// When loading the editor, copy the correct version of the EyeX client
/// library to the project root folder to be able to run in the editor.
/// </summary>
static EyeXClientLibraryDeployer()
{
var targetClientLibraryPath = Path.Combine(Directory.GetCurrentDirectory(), ClientLibraryFileName);
if(!File.Exists(targetClientLibraryPath))
{
if(System.IntPtr.Size == 8)
{
Copy64BitClientLibrary(targetClientLibraryPath);
}
else
{
Copy32BitClientLibrary(targetClientLibraryPath);
}
}
}
/// <summary>
/// After a build, copy the correct EyeX client library to the output directory.
/// </summary>
[PostProcessBuild]
public static void OnPostProcessBuild(BuildTarget target, string pathToBuiltProject)
{
var targetClientLibraryPath = Path.Combine(Path.GetDirectoryName(pathToBuiltProject), ClientLibraryFileName);
if(!File.Exists(targetClientLibraryPath))
{
if (target == BuildTarget.StandaloneWindows)
{
if(System.IntPtr.Size == 8)
{
Copy64BitClientLibrary(targetClientLibraryPath);
}
else
{
Copy32BitClientLibrary(targetClientLibraryPath);
}
}
else if (target == BuildTarget.StandaloneWindows64)
{
Copy64BitClientLibrary(targetClientLibraryPath);
}
else
{
Debug.LogWarning("The Tobii EyeX Framework for Unity is only compatible with Windows Standalone builds.");
}
}
}
private static void Copy32BitClientLibrary(string targetClientDllPath)
{
File.Copy(Path.Combine(Source32BitDirectory, ClientLibraryFileName), targetClientDllPath, true);
}
private static void Copy64BitClientLibrary(string targetClientDllPath)
{
File.Copy(Path.Combine(Source64BitDirectory, ClientLibraryFileName), targetClientDllPath, true);
}
}
This worked for me (upgrading a 4.6 project to a 5.0 project), but if you encounter any problems, please let us know.
Best regards,
Patrik