Home Forums Software Development eyeX framework on Unity 5

Tagged: 

Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #2647
    Tim Tregubov
    Participant

    has anyone gotten the Unity sdk working on Unity 5?

    I’m getting:
    Multiple plugins with the same name ‘tobii.eyex.client’ (found at ‘Assets/Standard Assets/EyeXFramework/lib/x64/Tobii.EyeX.Client.dll’ and ‘Assets/Standard Assets/EyeXFramework/lib/x86/Tobii.EyeX.Client.dll’). That means one or more plugins are set to be compatible with Editor. Only one plugin at the time can be used by Editor.
    EyeX initialization failed because the client access library ‘Tobii.EyeX.Client.dll’ could not be loaded. Please make sure that it is present in the Unity project directory. You can find it in the SDK package, in the lib/x86 directory. (Currently only Windows is supported.)

    I’ve tried all permutations of deleting the x64 vs the x86 and that doesn’t seem to help.

    The same project works in Unity 4.6.3. Any thoughts?

    #2648
    Thomas
    Participant

    You can try deleting one of them, and then try to replace the dll in the project root (not the Assets/* folder). Base it on whether you run the 64-bit editor or not, maybe. I got it working by deleting the 32-bit one under Standard Assets/EyeX */lib, then (re)placing the 64-bit one in the root. Hope the same works for you.

    I also was wondering if anyone has had similar problems with the second error message. My colleague/student friend is migrating his project from 4.6 free to U5 Personal. After handling the duplication issue, Unity still can’t load the correct library no matter where we place it. We even tried opening the exact same project with the exact same files on my editor/computer, which works fine.
    Anyone have any troubleshooting tips for Tim and/or us here?

    Not trying to hijack your thread, thought I should just post here since it’s the same issue. =)

    #2649
    Tim Tregubov
    Participant

    I was able to fix the duplicate file problem by using Unity 5’s plugin inspector and just making sure the 64bit libs were checked off only for 64bit standalone and editor same for x86. So that fixes the duplicate libraries issue. But yep still having the can’t load the correct library problem. I’ve tried moving them around, root vs plugins, having only the 32 or only the 64bit ones, doesn’t seem to make a difference.

    Thomas, you mention that it works on your machine is that with U5 Personal also? I’m going to try it today on a different machine just for kicks.

    #2650
    Thomas
    Participant

    Glad you had some progress!
    I have a pro license (byebye student loan, glad Unity’s all free now!). We actually tried deactivating the license, effectively turning into a Personal version just for kicks, but it still worked, so… ;/ Hope you have some more luck with a different machine.

    #2652
    Patrik [Tobii]
    Participant

    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

    #2656
    Tim Tregubov
    Participant

    Hi Patrik – Thanks for the advice! Got a little bit further but still doesn’t work:

    EyeX initialization failed because the client access library 'Tobii.EyeX.Client.dll' could not be loaded. Please make sure that it is present in the Unity project directory. You can find it in the SDK package, in the lib/x86 directory. (Currently only Windows is supported.)
    EyeXHost:InitializeEyeX() (at Assets/Standard Assets/EyeXFramework/EyeXHost.cs:400)
    EyeXHost:Start() (at Assets/Standard Assets/EyeXFramework/EyeXHost.cs:188)

    So if I check the root dir of the project I do see: Tobii.EyeX.Client.dll

    Also in your directions above it wasn’t working until I copied Tobii.EyeX.Client.dll from each of /lib/x86,lib/x64 into the corresponding Assets/Plugins/ directories. Not sure if that was right? But before that the EyeXClientLibraryDeployer script was complaining about not finding it.

    Thanks for any help!

    Cheers,
    TIm

    #2657
    Patrik [Tobii]
    Participant

    Hello Tim,

    You’re absolutely right. I forgot to add the instructions to copy the Tobii.EyeX.Client.dll to the Plugins-folder. Added those instructions. Thanks!

    It sounds like Unity is loading the x86 version of the Tobii.EyeX.Client.dll. Make sure that you copied the x86/x64 versions of the DLLs to the correct location.

    The EyeXClientLibraryDeployer.cs script will also only copy the client library to the root if it does not already exist, so try removing the Tobii.EyeX.Client.dll from the root (and the corresponding meta file).

    If it’s still not working for you, then contact me again and I will see what I can do.

    Best regards
    / Patrik

    #2658
    Patrik [Tobii]
    Participant

    Tim,

    I also updated the script to make sure it doesn’t copy the client library if it do not already exist.

    Best regards
    / Patrik

    #2676
    Tim Tregubov
    Participant

    Hi Patrik –

    I tried it with the updated script and making sure to follow each of the steps (tried again with a fresh project) and it didn’t work still. Any more ideas?

    Cheers,
    Tim

    #2677
    Sage
    Participant

    Thanks this helped a bunch.

    #2678
    Patrik [Tobii]
    Participant

    Hello again Tim,

    I tried myself to recreate the solution following the steps a couple of times, and I got the same problem as you’re experienced.

    What worked for me was to remove the copied Tobii.EyeX.Client.dll from the root while Unity was running and then simply run the game to force it to copy the DLL again. After that, everything seem to work as expected. Not sure why this happen, but I guess it has to do with Unity caching the old version of the DLL somehow. To be honest, I have no clue but I will investigate this further.

    I’ve also updated the conversion steps (moved #14 to #1).

    Best regards
    Patrik

    #2690
    Tim Tregubov
    Participant

    Hi Patrik – Thanks, just tried that and it also didn’t work. I verified that the file was being copied and that is definitely happening. I’m running 64bit editor and building for 64bit, neither editor nor build work. I’ve checked the file and it’s definitely copying the right one. So weird! Do you guys have a newer version of the sdk that might work? I’m using 1.3.443, is that right?

    #2692
    Patrik [Tobii]
    Participant

    Hello Tim,

    Is there any possibility that you could send me something that reproduces this problem?
    I’m really interested in resolving this problem for you (and other people who might have the same problem).

    If you got DropBox/OneDrive or similar service you can just send me a link to patrik.svensson[at]tobii.com.

    Best regards
    Patrik

    #2746
    Claudio Medina
    Participant

    I managed to get this working with the sample scenes but not with a new project I’m testing. Can’t reproduce why.
    EyeX initialization failed because the client access library ‘Tobii.EyeX.Client.dll’ could not be loaded. Please make sure that it is present in the Unity project directory. You can find it in the SDK package, in the lib/x86 directory. (Currently only Windows is supported.)
    UnityEngine.Debug:LogError(Object)
    EyeXHost:InitializeEyeX() (at Assets/Standard Assets/EyeXFramework/EyeXHost.cs:399)
    EyeXHost:Start() (at Assets/Standard Assets/EyeXFramework/EyeXHost.cs:188)

    There’s nothing in the lib folder, nothing in the root folder of plugins and I’m pretty sure I have the right X64 file in the X86_64 folder.
    Any clues?

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