October 14 2019
Players want to play, they don’t want to wait. Help them buying your game: reduce your game’s download size with Unity Addressables Hosting. And a year later? Offer them a DLC based on, guess what? Unity Addressables.
Picture your potential player on a Friday afternoon.
Your player has just left behind a hard week with long working hours. Their wife or husband is gone to their family’s country house for the weekend along with the kids. The perfect time to go home, order pizza and browse through Steam with the wallet at hand.
With or without kids, with or without partner, we all had these awesome weekends.
Just videogames, please.
So your player comes across your newly released game in the Steam shop. They see all the effort you put into creating polished content.
No need for convincing, they hand in their credit card details and buy two copies of your game. One for theirself, another for their friend / brother / sister.
You get your 19.95 bucks, twice. Both users happily start installing the game.
But wait…
A wild Steam installation pop-up appears.
The remaining installation time suddenly exploded to 12 hours
What, 12 hours for over 30GB? What the fuck is in this game?**I’m not wasting my weekend on this shit, I’m out!
What happens afterward is not uncommon.
Your ex-player requests a full refund and purchase instead the next game in their wish-list.
One of the pain points for players is the waiting time wasted on downloading all the bytes of the whole game and start playing. People do not have that much time. Nothing will burn a hole in your wallet faster than an angry player.
Do you need to include in your installation package all these assets that are spawned in the level 5 of your game? Chances are, you don’t.
Players will need a couple of hours to play through the initial content of your game. Use that to your advantage
The idea is simple.
Provide the minimum content possible in your game installation package and download the rest while playing the initial levels of your game.
Can you picture your player ready to play in a mere minute after purchasing your game? How different would the reviews be compared to the ones commonly found with huge games?
Ideally, your game’s download size should be below 100MB.
But how?
This is what you will get by the time you’re done implementing the information of this article:
We started developing our game a few months ago and we have big plans for it.
You and I worked endless hours into creating highly polished content.
Not only that, we saw some great offers in the Unity Asset Store, so we bought several asset packs at heavily discounted prices.
Now our game is full of content our players will love to play through. Those Sci-Fi modular parts, the exploding particle systems, the punchy soundtrack.
It’s all gorgeous.
And heavy.
And slow to download.
Now your Android APK is well over 2GB, so you need to start messing with expansion files, which adds another good week to your efforts. But it’s fine, we all have time here.
Or maybe you’re publishing on Steam, so you can be at 30 GB, no problem. You just need a few hours for uploading it. And players? It’s ok, people have a fast connection nowadays.
So we released our game. Some players reported some bugs, so we make a 5-minute fix and we go through all the long process again. Build, wait for hours, upload to stores, wait for hours.
And our players? They just re-download the whole thing again. Wait for hours, then start playing.
It’s not a big deal.
Only that you are not recovering all the time you wasted on this previously. And a great deal of your players will stop downloading your game once they see how many hours they have to wait. That only gets worse with each update. Did I mention refunds?
We can do better than this, now that we have the tools.
Let’s upgrade our skills to Level 2.
Welcome to Unity Addressables.
This package will allow you to efficiently manage your game assets. That, my friend, includes online distribution. For an introduction on this topic, visit my previous article on Unity Addressables Benefits for your game.
These are the steps you and I will be following in the article:
Like granny said, a 2D sprite is worth a thousand times:
Let’s start with…
It’s our lucky day. Amazon offers a free tier for their S3 service.
That means, we’re going to host our content for free. The limitations for their free tier is mostly storage space and the number data transfers. At the moment of writing this, you can store for free up 5GB and perform 20,000 GET and 2,000 PUT requests, but do double check it in the official site of AWS Free Tiers.
What we are going to do here is to create an account for AWS so we are ready to upload our game content for further distribution.
You and I will do this as fast as possible. No need to waste time in detail. No BS.Setting up Amazon S3 Hosting for Unity Addressables
Navigate to the AWS Management Console and click on Create a Free Account.
Enter your e-mail and bla bla bla. That will take you roughly a minute.
Be aware that you’ll need to give them your credit card info to verify your identity.
Unless you’re going pro right from the start, we want to evaluate this in our game first.
So, after confirming your account, choose the basic plan.
After a few minutes, your account will be activated (you’ll get an e-mail). Then, sign in to your new console and open the S3 service panel:
You are now located at the S3 control panel.
Now we are ready to create the bucket like shown below (change your bucket name and region!):
Leave the permissions set to public for now, you’ll have the chance to tweak them in the future.
Your S3 bucket for Unity Addressables is now ready, congratulations!
That was the most tedious step.
The next step is a piece of cake: time to get your Unity Project to produce downloadable assets.
Summary
Finally we made it to Unity. That whole S3 process was getting old.
I will assume you have some content marked as Addressable in your game. If that’s not the case because you are new to this, don’t worry, I have you covered with the previous Unity Addressables Tutorial I wrote.
I’ll show you the steps to get content uploaded in your newly created AWS S3 Bucket. We will do so based on a project I created for this purpose.
Instead of following the whole story, you can also skip the line, get access to de code now and read later.
The way to start is to tell Unity where to load remote assets from.
That we achieve by tweaking our Addressables Profile Configuration. In the Addressables main window, click on:
Profile: Default → Inspect Profile Settings.
This will redirect you to the settings we need to tweak.
Here is a collection of funny toys you can play with, but for our purposes we just need to focus on the Profiles section.
We want to make sure we set the Addressables RemoteLoadPath field to the correct URL.
We form the RemoteLoadPath URL by concatenating our S3 Bucket URL with the Unity variable [BuildTarget], like below:
https://YOUR-BUCKET-NAME.s3.YOUR-REGION-NAME.amazonaws.com/[BuildTarget]
E.g. https://thegamedevguru.s3.eu-central-1.amazonaws.com/[BuildTarget]
The [BuildTarget] variable is left on purpose so Unity fetches in run-time the right assets for each of the platforms we build for. Android assets will be packed differently from Standalone, so each of these platforms will require a different directory.
The way I found my S3 Bucket URL is by uploading a random file; if you then navigate to its details, you’ll see the base URL of your file and hence your bucket.
So, we just told Unity where to load the remote assets from through the RemoteLoadPath variable.
Great. What is left is to tell which assets should be loaded remotely. Easy.
You can see a graphical breakdown of this entire process below.
![Asset Groups for Unity Addressables Hosting](../../uploads/2019/10/Unity-Addressables-Hosting-Asset-Groups.jpg "Unity-Addressables-Hosting-Asset-Groups")Asset Groups for Unity Addressables Hosting
We now have our skybox content assigned to a group that will be downloaded by your players in run-time.
Summary
All our settings are now in place. What about uploading our content to S3?
This is a simple two-step process:
Building Addressables Player Content is straightforward. Open the Addressables main window and press the button that does just that. This will cook the assets for the current platform your editor is in.
The output content will be stored in the path dictated by the RemoteBuildPath variable you happened to see early in the Unity Addressables Profile Settings. If you didn’t modify it, it’s likely to be in a subfolder of your project called ServerData.
The second step involves navigating to that directory and dropping its contents into the website of your S3 bucket, as you can see just below:
There you have it, it’s that simple.
However, this can quickly become tedious. It’s a very manual task that could easily be automated. I did just that so now uploading all my assets takes the press of a button inside Unity Editor.
To upload your Unity Addressable Assets directly from the Unity Editor, check my Unity Addressables Hosting Resource Pack at the end of the article.
This is the part we all were waiting for. You now have a game you can distribute that is significantly smaller. The remaining part is launching it and watching it download the assets on demand!
If you want to make sure these assets are being effectively downloaded, delete the data from your S3 Bucket, disable the caching option in your Addressable Asset Group Settings, rebuild the content and your player. If you launch it, you should see a few error messages pop up, as you can see below.
If you followed this tutorial on Unity Addressables Hosting, chances are, you will be totally alright
By now, the asset groups you marked to be remotely downloaded are hosted in S3 and Unity knows how to fetch them.
By now you should have your first Unity Addressables Hosting experiment up and running.
You learned how to build player content specifically to target downloadable content.
That’s great, but there’s more than just the basics. To help you further, I prepared a Free Unity Addressables Hosting Resource Pack just for you. This bundle contains:
Level up your skills. Download it now.