Home Forums EyeX Software Development dev EyeX for Unity cannot build in Mono

This topic contains 5 replies, has 3 voices, and was last updated by Profile photo of Robert [Tobii] Robert [Tobii] 3 years ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1053
    Profile photo of Guillaume
    Guillaume
    Participant

    Hi,

    I followed the instruction to download and install the REX dev kit with the EyeX SDK and Unity. The calibration works fine and I can load the example code in Unity (and run the demo scenes). However when I compile the existing code (even before modification from me) I get the following 4 errors (same on 2 different computers) :

    Error Error: System.BadImageFormatException: Could not load file or assembly ‘UnitySamples\Assets\Plugins\Tobii.EyeX.Client.Net20.dll’ or one of its dependencies. An attempt was made to load a program with an incorrect format. (Error: System.BadImageFormatException) (Assembly-UnityScript-firstpass)

    Error File name: ‘\UnitySamples\Assets\Plugins\Tobii.EyeX.Client.Net20.dll’ (File name) (Assembly-UnityScript-firstpass)

    Error WRN: Assembly binding logging is turned OFF. (WRN) (Assembly-UnityScript-firstpass)

    Error Note: There is some performance penalty associated with assembly bind failure logging. (Note) (Assembly-UnityScript-firstpass)

    More surprising it seems that my compiling somehow works because I can still run the scenes (I tried small code modifications to be sure and it actually takes the modifications into account).

    Should I work like this ?

    #1063
    Profile photo of Anders [Tobii]
    Anders [Tobii]
    Moderator

    Hi Guillaume,
    Unity creates two solution files for you, one called UnitySamples.sln and one called UnitySamples-csharp.sln. The difference between the two is that the one without the “csharp” includes ALL script code projects, not just the ones for C#. And the project that fails with the errrors you describe happens to be one written in UnityScript. So the easy fix is to use the “csharp” solution file instead: no errors, everybody happy! 🙂

    The reason for the error is that Unity:
    a) adds assemblies in the plugin directory as references to ALL script code projects, not only the ones written in C#.
    b) expects the assemblies referenced from the UnityScript assembly to be compiled for Any CPU, but the Tobii.EyeX.Client.Net20 assembly is compiled for the x86 platform (the SDK package also includes one for x64).
    An alternative solution to the problem is to remove the reference to Tobii.EyeX.Client.Net20 from the UnityScript project. But Unity will probably insist on putting it back there every time the project file is re-generated.

    #1065
    Profile photo of Guillaume
    Guillaume
    Participant

    Hi Anders,

    Thank you for your answer and this explanation!

    I tried a few things but I am not too sure about what to do exactly when you say the solution is to “use the “csharp” solution file instead”. Do you mean compiling in mono in a different manner ? Or is it an option to choose before compiling ?

    Thanks a lot !

    #1068
    Profile photo of Anders [Tobii]
    Anders [Tobii]
    Moderator

    Hi Guillaume,
    you can open and work with the UnityProject-csharp.sln solution file in MonoDevelop instead of the UnityProject.sln file. Just use File/Open and browse for it.

    #1071
    Profile photo of Guillaume
    Guillaume
    Participant

    Hey Anders,

    Thanks a lot for your quick answer. Very clear, it solved most of it. I still had one error : “\UnitySamples\Assets\Scripts\EyeX\EyeXHost.cs(17,17): Error CS1501: No overload for method ‘Shutdown’ takes ‘0’ arguments (CS1501) (Assembly-CSharp-vs)”

    I deactivated the following part in the code and it works but I guess it’s not a very safe option :

    if (_context != null)
    {
    // attempt to shut down the context nicely before disposing it.
    try
    {
    _context.Shutdown();
    }
    catch (InteractionApiException ex)
    {
    print(“EyeX context shutdown failed: ” + ex.Message);
    }

    _context.Dispose();
    _context = null;
    }

    #1078
    Profile photo of Robert [Tobii]
    Robert [Tobii]
    Moderator

    Hey,

    The method takes two arguments, but should use default parameters if invoked without arguments. Instead of commenting out the code, you can try to call Shutdown with the default arguments.

    I hope that solves the problem. We will fix it in the next version of the EyeX SDK for Unity.

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.