How to run really long function without dropping FPS

Hi, is it possible to run a really long function in the background without dropping frames? The function is in a DLL file, so I can’t break it into pieces. I’ve looked at jobs and coroutines, but they seem to require you to break the function down into steps or pieces. Is there a way to just run the long function in the background, and let unity update the frames while this is all happening?

Use a thread! There are a bunch of tutorials out there, at a glance this one looks good.

Your best bet is probably to use another thread. C# Tasks are a good place to start: Task Class (System.Threading.Tasks) | Microsoft Learn