WCF and Unity

I am creating a game using Unity and am considering using WCF (Windows Communication Foundation) web services to implement online scoreboards, execution tracking, etc. Before I go down this route I was wondering if there are any known issues with this approach? For example, are there certain platforms that do not support WCF web service consumption?

WCF has worked well for me in the past in Windows .NET desktop application development, but I know Unity/Mono is a different animal. Any thoughts on the topic would be appreciated.

Thanks!

I know some folks have gotten it working, but I’m guessing there are platform limitations (probably not going to work on Mobile though I’m not sure). It also depends on your WCF service. You’re going to have more luck if you’re using the WCF Rest based services than if you’re trying to use SOAP services.

Also, Unity doesn’t have the System.Data namespace, so sharing your models can be problematic (not having DataMember, DataContract or EnumMember attributes). What I did in my JSON .NET port was to take those System.Data attributes from the Mono source and shim them in by adding them in code.

writing the service side in mono has VERY LIMITED support.

Do not expect to use Unity/Mono as the service’s server. If you do, you’re going to have restrict the abilities of WCF a lot. Go with .Net and a windows server.

As for as a client, pfff, WCF is designed to allow just about anything as a client, all it needs to do is format the messages correctly (and of course have network/internt access to the service location). I haven’t ever used Mono to consume the service (i have consumed it with js, .net, java, and others), but I would hope the mono team at least got THAT working correctly.

Here’s the mono page on WCF:
http://www.mono-project.com/WCF_Development

You should research consuming WCF services with Mono. Noting the version of mono being used in your build of your unity game. The unity aspect is really inconsequential here… it’s all about mono.

If the built in mono support for consuming doesn’t work (it could be buggy), you could always roll your own. Like I said, you just have to format your messages correctly is all. WCF is just a messaging service, usually formatted in xml.