Control Unity from C# app

Hi there,

I am wondering what would be the best way of launching and sending commands to a unity instance? (commands such as which view point to show, initially working on windows)

I have vaguely thought that inter process communication via Mono should work but wondered if anyone had done this or had any advice to share?

If not i'll have a shot in a weeks time or so and try and remember to post back

Thanks

David

A unity C++ plugin with a C# wrapper?

Named pipes ought to work, though I've not tried it personally.

MSDN has docs for System.ServiceModel.NetNamedPipeBinding, and Mono includes System.ServiceModel. The System.SericeModel.dll is present in my Unity install (under Data\Mono\lib\mono\2.0), but I get a compile error from "using System.ServiceModel".

I got the compile error to go away by copying System.ServiceModel.dll and System.Security.dll into my Assets\Plugins folder, but I haven't tried to actually use it. (Is there a better way to enable additional Mono assemblies?)

Let us know what you come up with, I'm interested in this topic.

I would go for a listening socket.

You could also use OSC http://en.wikipedia.org/wiki/Open_Sound_Control, for example. One advantage is, it is already available as Unity C# scripts, as part of uniTUIO http://xtuio.com/index.php/projectsmain/utuiomain.

While originally designed for transmitting sound parameters between electronic synthesizers and such, you can transfer just about anything between applications (and between networked computers) using this protocol (ints, floats, strings, ...).

uniTUIO, a multitouch interface for Unity, uses the TUIO protocol, which is implemented on top of OSC. But you can also use the OSC classes directly, without TUIO.

It might be overkill, and you could do your own thing using a socket (which is just what OSC does, after all), as Keld lykke suggested, but it is a ready-to-use framework for purposes just such as this.