Add serial number to unity3d build MAC/PC

Is there a way to protect your build with serial number? If you make a build for the PC or mac what prevents someone from just posting your game online to be downloaded for free after they purchase it. is there any programs that work well with unity?

There is not a built in method to protect your downloadable files.

DRM is a very tricky and hotly debated subject. DRM will almost always conflict with your paying customers ease of use, and that tradeoff between absolute security and absolute freedom is a thin line.

A basic serialization scheme might consist of generating unique, single use serial numbers, and then locking the game to a users hardware with unique identifiers, such as the MAC address (which is not accessible in Unity, or even in Mono - hence why you can't get it in Unity, you'd have to write a custom plugin in Mac and Windows). You can also use processor and GPU type, which is accessible in Unity, but this isn't unique.

I imagine this is best done by connecting to a web server to generate the ID's and send a secured 'unlock' message to the client, which would be stored in the prefs.

You could then take these values, hash them together, and store them in a preference file. Copying the preference file would not unlock another users program, unless they tricked it to think their hardware ids were the same as the original purchasers machines (which is very possible, but beyond the skills of most lay people).

Keep in mind, such a scheme would prevent legitimate customers from installing on multiple machines - and the result would be a lot of unhappy customers and wasted time on customer service. A better approach might just be to store the hashed serial in a preference file, and use that. Dedicated pirates will still be able to copy your software by taking the app and the preference file, but most of them could probably steal it anyway - and you would likely deter 90% of people who would steal the application.

I personally think the best DRM is a scratch more than nothing, unless you are developing very expensive software such as photoshop or maya, in which case - you probably need something more clever.

There are third party wrappers you can use as well, but I am personally unfamiliar with these, and the ease of use vs security concerns still exist.

Brian's answer is pretty much it. I'd perhaps express it slightly differently in that the game/software is 100% free and anyone can give it away. What your customers are paying for is the ability to connect to a server, upload scores, compete against other users and so on. If you design your game so that the best experience is the one where your customers are online, then the free give-away version is really then giving people a taster of what the full game would be like.