Jump to content
  • Advertisement
  • 09/29/19 02:19 PM

    Unity
    3 Ways Unity Addressables Will Save Your Game

    General and Gameplay Programming

    Ruben Torres

    [This post was originally posted with its original formatting at The Gamedev Guru's Blog]

    If you've been following me, you will probably know my interest in Unity Addressables. That is for a reason.

    3-Ways-Addressables-Will-Save-Your-Game-

    Unity Addressables is a powerful Unity package that upgrades the way you and I have been tackling some of the most important challenges in Game Development: efficient, pain-free content management.

    When managing your game assets, it's hard to keep good standards that prevent our project from becoming a disgusting pile of mess. A big issue there is the coupling between the different responsibilities of our asset management systems.

    The way we store the assets in our project has way too much to do with the method we load them, and later use them.

    For instance, you may decide to store an innocent sprite in the Resources folder. This, in turn, will force Unity to build the player in a way that that sprite is put into special archive files. And the fact that it was put there, will corner you into loading it through the Resources API.

    Things get messy quicker than you can realize!

    One choice, multiple long-term consequences.

    A good system will prevent you and me from easily making sloppy mistakes like that. A great system will be that, and also easy to learn and use.

    With Unity Addressables, we separate the asset management concerns. Our goal is to remain flexible and to keep our project maintainable.

    Here are 3 proven ways Unity Addressables will help you and your games:

    RAM.jpg

    1. Reduce Your Game's Memory Pressure

    When you publish your game, you'll be required on most platforms to specify the minimum hardware specifications your players must meet to buy and play your game.

    The math is easy here: the more hardware power you demand, the fewer will buy your game. Or, seen from another perspective, the better memory management you do, the higher the amount of content and fun you can offer in your game.

    Unity Addressables helps you in this regard enormously!

    To give you a brief idea, converting this kind of code:

    public class CharacterCustomization : MonoBehaviour
    {
        [SerializeField] private List<Material> _armorVariations;
        [SerializeField] private MeshRenderer _armorRenderer;
    
        public void ChangeArmorVariation(int variationId)
        {
            _armorRenderer.material = _armorVariations[variationId];
        }
    }

    Into this other one:

    using UnityEngine.AddressableAssets;
    
    public class CharacterCustomizationV2 : MonoBehaviour
    {
        [SerializeField] private List<AssetReference> _armorVariations;
        [SerializeField] private MeshRenderer _armorRenderer;
    
        public IEnumerator ChangeArmorVariation(int variationId)
        {
            var loadProcess = _armorVariations[variationId].LoadAssetAsync();
            yield return loadProcess;
            _armorRenderer.material = loadProcess.Result;
        }
    }

    Will bring you these results:

    Unity-Addressables-Memory-Gain.jpg

    Easy gains I'd say.

    -> Read more on Unity Addressables for better memory management in Unity Addressables: It's Never Too Big to Fit (opens in a new tab)

     

    Controller

    2. Sell Your Next DLC - Quick and Easy

    The fact that Unity Addessables gives you full control over how, when and where to store and load your game assets is incredibly useful for implementing and selling Downloadable Content.

    Even if you are not thinking of releasing DLCs any time soon, just by using Unity Addressables in your project, you will have done already a big chunk of the work ahead.

    Other approaches for selling DLCs, such as Asset Bundles, are a very deprecated way of doing the same thing but at a much higher cost. Maintaining a well-functioning Asset Bundle pipeline is painfully time-consuming and requires a high degree of expensive expertise.

    There are many ways you can approach implementing DLCs in Unity, but for starters, this is a good starting point:

     

    public class DlcManager : MonoBehaviour
    {
        // ...
        public IEnumerator TryDownloadDlc()
        {
            if (_hasBoughtDlc && _dlcDownloaded == false)
            {
                var operationHandle = Addressables.DownloadDependenciesAsync("DLC-Content");
                while (operationHandle.IsDone == false)
                {
                    _progressText.text = $"{operationHandle.PercentComplete * 100.0f} %";
                    yield return null;
                }
            }
        }
    }

    You get the idea.

    Why would you say no to selling more entertainment for your players at a fraction of the cost?

    Time.jpg

    3. Reduce Your Iteration Times

    Using Unity Addressables will reduce the time wasted waiting in several areas.

    Tell me, how frustrating is it to be blocked for half a minute after pressing the Unity play button? And it only gets worse if you deploy your build on another platform, such as mobile or WebGL. This all starts adding minutes and minutes to your iteration times. It gets old so quickly.

    I don't like waiting either.

    But do you know what I like? Unity Addressables, my long-awaited hero. This is how Addressables will help you:

    A) Reduced Build Size

    Your game has a lot of content, I get it. Gamers love enjoying content. Developers love creating content.

    That doesn't mean, however, that every single asset you produced has to be included in the build your players will install. In fact, you should remove as much as possible.

    Players want to start playing ASAP. And they're not happy when your game steals 2GB of their data plan and 30 minutes of their gaming time. They'll just keep downloading Candy Crush kind of games that install well under 50MB.

    One strategy is to include only the assets needed to run your game up to the main menu. Then, you can progressively download the rest of your content in the background, starting, of course, downloading the first level of your game.

    It's also neat to realize that your deployment times during development will be much faster. You'll be able to iterate more times each day; this benefit quickly adds up in the long term.

    Unity Addressables - Reduced Build Sizes

    Unity Addressables - Reduced Build Sizes

    B) Reduced Load Times

    We, both as game developers and as players, hate waiting. Waiting takes us out of the zone and before you realize it, it is time to go to bed.

    Unity is working hard towards reducing the time it takes us to start playing our games, both in the Unity Editor and in the games we distribute.

    But not hard enough.

    Things look promising in the future, but not without side effects. Avoiding domain reloads in Unity 2019.3 looks promising, but as of today that's still in beta and not everyone can profit from it.

    In the mean-time, we can do better than just being frustrated.

    Let's say you're working on a medieval game. Several months ago, you implemented armor types for your game. You did a pretty damn good job and generated over 100MB of content.

    At some point, it was time to move on and right now you're working on something else, let's say sword fighting.

    Realize that, every time you press the play button to work on your features, you are loading an insane amount of data coming from all the already developed features, and loading this data takes a massive amount of time. You press play to test your sword fighting animations, and you spend 5 seconds waiting due to loading the armor features you implemented.

    The time wasted in loading is mostly spent on I/O (Input/Output), because memory bandwidth is expensive. And, on top of that, your CPU has to process it. You, as a developer, pay this time penalty while developing in the Unity Editor. But your players pay it as well in the games you are distributing.

    Knowing how big of a deal this can be, let's ask ourselves: which shortcuts can we take here?

    It turns out that Unity Addressables can help us here in two ways.

    1. Unity Addressables will reduce your Players' Loading Times

    We can alleviate some of our players' pain.

    Keeping indirect references to our assets instead of direct references will drastically improve your loading times.

    By using indirect references (AssetReference), Unity will not load everything at once but only what you tell it to. And more importantly, you have direct control over when that happens.

    2. Unity Addressables will reduce your Unity Editor Iteration Times

    How much do you know about the play mode script in the Unity Addressables Window? The play mode script defines how the Unity Editor should load the content marked as Addressable.

    With Packed Play Mode selected, Unity will directly load your pre-built addressable assets with little to no processing overhead, effectively reducing your Unity Editor iteration times

    Just do not forget to build the player content for this to work

    Unity Addressables - Build Player Content

    Unity Addressables - Build Player Content

    What if you applied these strategies to your most demanding content?

    4. Extra: Are You There Yet?

    It is true. Unity Addressables is very helpful. But this package will help only those who want to be helped.

    After reading how Addressables will help you producing better and selling more to your players, you probably want to start with it right away. However, starting in this new unknown area may be challenging.

    To make the most of your chance, answer these questions first:

    • Where are you standing right now? Are you just starting, or are your skills production-ready?
    • When to use indirect references, when to use direct references?
    • What's the bigger picture?
    • What is your next logical step?

    → Take this short quiz now to test your answers ← (opens in a new tab)

    Quiz.jpg



      Report Article


    User Feedback


    There are no comments to display.



    Create an account or sign in to comment

    You need to be a member in order to leave a comment

    Create an account

    Sign up for a new account in our community. It's easy!

    Register a new account

    Sign in

    Already have an account? Sign in here.

    Sign In Now

  • Advertisement
  • Game Developer Survey

    completed-task.png

    We are looking for qualified game developers to participate in a 10-minute online survey. Qualified participants will be offered a $15 incentive for your time and insights. Click here to start!

    Take me to the survey!

  • Advertisement
  • Latest Featured Articles

  • Featured Blogs

  • Advertisement
  • Popular Now

  • Similar Content

    • By Florian Gionnane
      Our team at Darkstar Games is looking for some motivated developers to join our new TCG MMORPG game called "Greater Powers".

      We are previewing KS for Q1 2020 and are set to create a unique and epic videogame !
      Our team members work for corporate equity (corporate shares). 
      Every team member who has shown active participation is granted stock option in the corporation. And Department directors will be distributing cash bonuses to team members who contribute significantly to the project during development.

      Skillset especially needed:
      -> Concept artist
      -> Rigger
      -> Animator
      -> C# programming 
      -> Graphic design
      -> 3D modeling (especially for structures, creatures and skyships)
      -> Good knowledges level in Unity3D

      If you're looking to join in on an up and coming original game company send me your Portfolio to: flosambora123@gmail.com
      Hope to hear from you soon ! 
      https://www.facebook.com/DarkstarGamesCorp/



    • By RoKabium Games
      Each upgrade shows the amount of items and energy needed to build that component. This number of items will count down as you find more resources while mining. A green tick means you have enough items of a specific kind required for that upgrade. When you have all resources needed to build a specific upgrade a yellow dot in the top right corner of the icon will appear.
    • By Octane_Test
      I want to implement 3D water in my game similar to this 2D plugin.
      I know that usually water is implemented using plane deformation. I can't use this approach as I want to implement realistic water simulation similar to the above 2D plugin. I tried implementing the water using metaballs but the performance is poor as I need thousands of metaballs.
      I am looking for suggestions about the possible approaches using which 3D water can be implemented. Also, how fluid in Obi Fluid plugin is implemented?
    • By intenscia
      mod.io is an cross platform mod service created by the team behind ModDB.com and IndieDB.com. It can be integrated in-game using the  REST API, C/C++ SDK or engine plugins (if available) Unity and Unreal Engine are ready to use with other engine plugins in development.
      Features include:
      Platform agnostic (support 1 click mod installs on Steam, Epic Games Store, Discord, GOG, itch.io and even consoles in the future) Clientless (mod.io has no other dependencies and works behind the scenes in your game) Embeddable web app UI, so you can integrate your mod community anywhere Powerful search, filtering and tagging of mods Moderation and reporting systems built-in Steps to getting mod.io integrated:
      Add your game to our test environment or production Read our API documentation for an overview of how mod.io works Choose an Engine Plugin, API or SDK to integrate mod.io into your game and mod making tools Ready to launch? Add your game to our production environment then let's discuss promoting your release Need help? Our team is available on Discord to assist and our getting started guide has more information for you  
       
      Benefits of using mod.io:
      mod.io offers the same core functionality as Steamworks Workshop (1 click mod installs in-game), plus mod hosting, moderation and all of the critical pieces needed. Where we differ is our approach to modding and the flexibility a REST API offers. For example: 
      Our API is not dependent on a client or SDK, allowing you to run mod.io in many places such as your homepage and launchers Designing a good mod browsing UI is hard, our plugins ship with a UI built in to save you a lot of effort and help your mods stand out We don’t apply rules globally, so if you want to enable patronage, sales or other experimental features, reach out to discuss Our platform is built by the super experienced ModDB.com team and is continually improving for your benefit Your community can consume the mod.io API to build modding fan sites or discord bots if they want Large studios and publishers:
      A private white label option is available to license, if you want a fully featured mod-platform that you can control and host in-house. Contact us to discuss.
      Find out more:
      Visit mod.io | About us | Add your game | Chat on Discord
      These screenshots are from our Unity plugin:




×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!