Are calls to C++ DLL handled asynchronously?

Hi everyone,

When I call an imported function (from a C++ DLL), will Unity stall until the function finishes executing, or will it still run asynchronously? The dll does some extensive computing that takes 30-100ms, and I don’t want the program to lag during that time.

Thanks in advance!

That doesn’t have anything to do with the DLL, or Unity, but how the function’s set up and/or how you’re calling it. Async doesn’t just happen, no, and there’s nothing about calling a function in a DLL that’s going to automatically run it asynchronously.

There’s a lot of good information in the .NET documentation of course, and you might also want to look into BeginInvoke/EndInvoke and Tasks. Here’s a really good article specifically about using async in Unity. And of course check out any documentation on threading / multithreading / threadpooling.