Unity exe sharing data or exposing functions to a non-unity exe

Hello! I’ve been trying to make a direct connection between a Unity executable and a non-Unity executable without having to use network services; I just want to be able to send continuously an array of vectors from the non-Unity application to the Unity application while both are running at the same time.

Is this possible? So far I tried both of them sharing a dll with a variable within, but my understanding of dlls was amiss as it seems each program uses the dll as a different instance for each. Do you know of any other approach I could look into it?

Thank you in advance :slight_smile:

Named pipes would work.

Great! Will look into it!

Thank you very much! :smile:

I’ve been trying to do something similar and was kinda successful using the data_seg pragma. I still haven’t tested it extensively, tho. Would you happen to know if there are any disadvantages for this approach instead of sending messages using named pipes?

That looks like a pretty good way to do it, you just need to make sure you do the synchronization correctly (using global mutexes I assume).

I had never heard of such class! Where should this be implemented? On Unity’s side or dll’s?

You mean global mutex? You’d use it in the DLL before accessing the shared data.

Oh my! I did not see you had responded my question! My apologies!

In the end, the approach I implemented wasn’t suitable for what we are trying to do and had to start over.

Still, thank you!