How do I create licenses/product keys for my Unity games?

Is there an easy way to license games created within Unity, and ensure they are only installed on a set number of machines, or by specific users who have paid for it.

First, just to make sure, there isn't anything inherent in Unity that would prevent this from being possible, is there? (I suspect there is not, but just want to cover my bases.)

Second, how could this be done? Does Unity provide any libraries that can be used to do this, similar to how Unity itself manages licenses? Or are there 3rd party plugins that do this?

What you'd look into is DRM libraries to protect games. Basically, any DRM library should work and I think I remember some people on the forums mentioning that they've been successfully using that.

Here's one forum thread: How to protect Unity games from copying/abuse

Another relevant forum thread: Copy protection or Copy protection for Windows game?

One solution that is frequently used for games: SoftwarePassport, Unity itself uses PACE - which, from how I ready the Website also includes all the infrastructure for your serial numbers etc.

And here's a forum thread of someone struggling with integrating DRM (might also help when looking into that): struggling to hook up a 3rd-party DRM

A little inspiration on how to "creatively deal" with piracy: Arkham Asylum: Creative DRM

If you're developing for iPhone, you're lucky because this is handled for you by Apple. The bad news: Apps from the AppStore to do get cracked, too. But that's a general problem - there's no such thing as total security, even with DRM. So, eventually, you might look into Fighting piracy by sueing.

Of course, you could also "roll your own" system: You'd set up a database, some Web service for the software to check back, create a way to generate your own serial numbers, a Web interface for your customers to register / authorize their installation.

One could also think of a combination: 3rd party copy protection for your game + your own system for authorization / serials etc.

Finally, if you're going through a portal there's a chance that they have a solution that you'll have to use. So, in general it's usually a good idea to not worry about copy protection too early in the process.

Use AppProtect or QuickLicense/AddLicense to build a protected EXE or APP from a Unity game. See info and demonstration videos at www.excelsoftware.com.

I was wondering the same a few weeks ago so we started developing something ourselfs, it proved useful so we submitted it to the asset store