- Home /
Question by
MarkZZZ · Oct 10, 2012 at 09:34 PM ·
performancedllopenglc
P/Invoke slow when in OnGui()?
Hi all,
I'm working on a project in Unity that is using a .Net 3.5 C++ DLL that I wrote to handle a lot of the data processing. Currently, I am streaming data from a bluetooth device and doing some number crunching via P/Invoke calls during a GameObjects update. The user has the ability to show graphs of the data. The data is drawn using OnGui and GL calls, but the data is still accessed via P/Invoke calls.
Before I made the C++ DLL, I had all this code in C#. The problem is that while the program has sped up overall with the use of DLL, when the graphs are being drawn the program becomes so slow it's unusable. Why is it that the graphing calls have made the game so unbelievably slow when it wasn't an issue before using a DLL.
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220613082146im_/https://answers.unity.com/themes/thub/images/avi.jpg)