Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Calling into C++ bluetooth reading code slows down Unity.

Discussion in 'Scripting' started by zerophase, Jan 29, 2016.

  1. zerophase

    zerophase

    Joined:
    Nov 5, 2013
    Posts:
    25
    So, I wrote a C++ plugin, since the code responsible for handling com ports in C# was taking forever to get the initial comm port. The C++ plugin can get the comm port in use by bluetooth within a couple seconds, while the C# code would block out. The only thing is I think overhead of going from C# to C++ to read from the bluetooth device is dropping my frames below 15 fps. While, just reading every second Anyone have any idea how I could speed this up with the C++? Are my frequent calls into C++ a potentially the cause of slow down?