How to Create a Unity Game on IPFS using Pinata
At the end of this blog, you will have learned how to:
- Install Unity and create a working game.
- Export your game.
- Upload your game to IPFS with Pinata.
Install Unity
Visit Unity and download your plan. There are many plans & pricing. Choose what suits you. This tutorial will work for paid and free plans.
Once installed, open Unity Hub.
If you want to build your game from scratch, then create a New project.
If you want a starting template, go to Learn and select a Microgame. In this example, we’ll create a Karting Microgame.
Download Project.
Once downloaded, click Play to test the game.
The game should be playable out of the box.
Export Game
Once you’re satisfied with the game, start your export. To play this on IPFS, you’ll have change the Build Settings. Select File > Build Settings
Switch Platform to WebGL. WebGL is a JavaScript API for rendering 3D and 2D graphics without the use of plug-ins. Most browsers support WebGL.
Now you can Build.
Select a name and path to save the exported game. In this example, we’ll call it karting-microgame.
Save and wait for the build.
The content should look like
Upload to IPFS
If you don’t already have a Pinata account, sign up. Once you are logged in, click on Pinata Upload in the upper right of the page and select Upload Directory.
Browse and select karting-microgame directory.
Upload
Next, navigate over to the Pin Explorer. The Pin Explorer is where you can manage all of your IPFS files on Pinata.
In the Pin Explorer, find the karting-microgame folder you just uploaded and click on the IPFS Hash link.
Here’s a working example:
https://ipfs.io/ipfs/QmWnFkgUxCvYBtn5ixaMCHZj7kC3m1om9h93qrMzM1ZSSt/
Your Unity game is now on IPFS. Now go ride off into the sunset. Happy Pinning!