Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

System.Io.Ports namespace does not exit??what is wrong???

Discussion in 'Scripting' started by JohnSonLi, Jan 18, 2013.

  1. JohnSonLi

    JohnSonLi

    Joined:
    Apr 15, 2012
    Posts:
    586
    I am very sure it indeed exists. what is wrong???
     
  2. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    There is no System.IO.Ports in the version of Mono used with Unity.

    --Eric
     
  3. JohnSonLi

    JohnSonLi

    Joined:
    Apr 15, 2012
    Posts:
    586
    Then How should I fix this problem????I need the serial port class .......for serial communication...
     
  4. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    ...Then again, it would be a lot more correct to say "there is no System.IO.Ports as long as you're using .NET 2.0 Subset in the player settings." If you switch to .NET 2.0 (not Subset) then you can import that namespace. (Although I haven't tested any of the functionality.)

    --Eric
     
    ismaelnascimentoash likes this.
  5. JohnSonLi

    JohnSonLi

    Joined:
    Apr 15, 2012
    Posts:
    586
    I fixed the problem before you replied haha.yes you are right.it is net 2.0,
     
  6. aandoni

    aandoni

    Joined:
    Oct 29, 2012
    Posts:
    3
    I have same problem with you.
    but, i was change net 2.0 Subset To net 2.0 .

    this is error message:

    IOException: Access is denied.

    System.IO.Ports.WinSerialStream.ReportIOError (System.String optional_arg)
    System.IO.Ports.WinSerialStream..ctor (System.String port_name, Int32 baud_rate, Int32 data_bits, Parity parity, StopBits sb, Boolean dtr_enable, Boolean rts_enable, Handshake hs, Int32 read_timeout, Int32 write_timeout, Int32 read_buffer_size, Int32 write_buffer_size)
    (wrapper remoting-invoke-with-check) System.IO.Ports.WinSerialStream:.ctor (string,int,int,System.IO.Ports.Parity,System.IO.P orts.StopBits,bool,bool,System.IO.Ports.Handshake, int,int,int,int)
    System.IO.Ports.SerialPort.Open ()
     
  7. alekz1k

    alekz1k

    Joined:
    Dec 14, 2014
    Posts:
    16
    Hello Aandoni,
    Im facing the same problem, did you find a way to solve it ?


    While Im posting here, do you know guys if uniduino works on unity free?
     
  8. JVirus

    JVirus

    Joined:
    Nov 14, 2017
    Posts:
    2
    IOException: Access is denied.

    System.IO.Ports.WinSerialStream.ReportIOError (System.String optional_arg)
    System.IO.Ports.WinSerialStream..ctor (System.String port_name, Int32 baud_rate, Int32 data_bits, Parity parity, StopBits sb, Boolean dtr_enable, Boolean rts_enable, Handshake hs, Int32 read_timeout, Int32 write_timeout, Int32 read_buffer_size, Int32 write_buffer_size)
    (wrapper remoting-invoke-with-check) System.IO.Ports.WinSerialStream:.ctor (string,int,int,System.IO.Ports.Parity,System.IO.Ports.StopBits,bool,bool,System.IO.Ports.Handshake,int,int,int,int)
    System.IO.Ports.SerialPort.Open ()
    (wrapper remoting-invoke-with-check) System.IO.Ports.SerialPort:Open ()
    UnityStandardAssets.Vehicles.Car.CarUserControl.Awake () (at Assets/Standard Assets/Vehicles/Car/Scripts/CarUserControl.cs:19)
    please help me :(
     
  9. whileBreak

    whileBreak

    Joined:
    Aug 28, 2014
    Posts:
    289
    Hey sup, it's what they said, you need to tell the project to use a different version of .net api

    Go to Player Settings > Other > Configuration > API Compatibility level and chose ".NET 2.0" instead of ".NET 2.0 Subset"
     
    ismaelnascimentoash likes this.
  10. JVirus

    JVirus

    Joined:
    Nov 14, 2017
    Posts:
    2
    I already Did sir. but still not working :(
     
  11. ismaelnascimentoash

    ismaelnascimentoash

    Joined:
    Apr 2, 2017
    Posts:
    30
    Yes