Unity-ZeroMQ-Example icon indicating copy to clipboard operation
Unity-ZeroMQ-Example copied to clipboard

Where do you learn about unity ZeroMQ?

Open offchan42 opened this issue 5 years ago • 2 comments

There is learning for ZeroMQ Python and C# but they are not specific to unity and I saw you use AsyncIO as well which is confusing for me because I'm not good at network programming. If I want to build a request-reply model but I want python to be the server instead of C#, how do I accomplish this task?

Python = server
C# = client

The idea is, I want to make some computation in python and return value to caller from C#. E.g. run machine learning model on an image sent by unity webcam and return the prediction to unity. The time it takes to run the computation might be long so unity should not wait for python to finish. Python have to callback unity later. Please give materials for me to learn about ZeroMQ request-reply model in unity. Any suggestions are appreciated!

offchan42 avatar Sep 16 '18 09:09 offchan42

I suggest you learn the concept of ZeroMQ from here: Learn ZeroMQ

Then, you find the corresponding functionality in NetMQ, and implemented. Note that Unity engine works very badly with NetMQ, so you may need to watch out a few tricks that I'm doing here, such as open a new thread, AsyncIO.ForceDotNet.Force();, and NetMQConfig.Cleanup();. Even then, there is not guarantee that it will work.

valkjsaaa avatar Nov 11 '18 20:11 valkjsaaa

Can you clarify what those 2 commands exactly do?

offchan42 avatar Nov 17 '18 19:11 offchan42