Search Unity

IL2CPP System.IO Serialport Arduino

Discussion in 'Scripting' started by MarkGreenDino, Mar 20, 2019.

  1. MarkGreenDino

    MarkGreenDino

    Joined:
    Jan 15, 2018
    Posts:
    3
    Hi,

    I'm currently working on a project that includes commucation with an Arduino device. This communication uses the System.IO.Ports.SerialPort class to open a port en read the data from the Arduino. The whole project works as should but now I want to convert the project to use the IL2CPP scripting backend instead of the Mono scripting backend.

    Unfortunately, I can't get my builds to work with IL2CPP as scripting backend. In the editor all works fine but when I build and run my project I get several "currently not available on il2cpp" errors. Even when I include the entire system.dll and mscorlib.dll assemblies in a link.xml file (not a good idea, I know), the System.IO methods throw exceptions in the build.

    When will the System.IO namespaces be supported by IL2CPP? Or is there a possible workaround I can use?
    My build should work on Windows devices only (not an UWP application).

    Any help is much appreciated!
     
  2. ASIM-SENYUVA

    ASIM-SENYUVA

    Joined:
    Apr 29, 2013
    Posts:
    90
    Same problem here. Still searching solution. Mono backend is working well but I2CPP not working for System.IO.Ports.SerialPort
     
  3. MarkGreenDino

    MarkGreenDino

    Joined:
    Jan 15, 2018
    Posts:
    3
    I have created a workaround by developing an C++ library that handles the Serial communications and then I reference it as a plugin from Unity. This way it works for both Mono and IL2CPP.
     
    xenoraider likes this.
  4. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,931
    We don't have any plans to support this code in IL2CPP soon. I'd recommend using Mono or doing a native code work around, as you mentioned.
     
    Joe-Censored likes this.
  5. ASIM-SENYUVA

    ASIM-SENYUVA

    Joined:
    Apr 29, 2013
    Posts:
    90
    I return to mono :) thanks for update.
     
    Joe-Censored likes this.
  6. xenoraider

    xenoraider

    Joined:
    Dec 22, 2015
    Posts:
    1
    Is it processible that share the c++ library you developed ? Thanks
     
  7. surajjorwekar1

    surajjorwekar1

    Joined:
    Apr 26, 2017
    Posts:
    1
    Hey do you mind sharing the library ? or atleast way you did it