• The multiplayer stack behind MMORPG Pantheon: Rise of the Fallen

    Finding your own path is at the core of gameplay in Pantheon: Rise of the Fallen – players can go anywhere, climb anything, forge new routes, and follow their curiosity to find adventure. It’s not that different from how its creators, Visionary Realms, approaches building this MMORPG – they’re doing it their own way.Transporting players to the fantasy world of Terminus, Pantheon: Rise of the Fallen harkens back to classic MMOs, where accidental discovery wandering through an open world and social interactions with other players are at the heart of the game experience.Creating any multiplayer game is a challenge – but a highly social online game at this scale is an epic quest. We sat down with lead programmer Kyle Olsen about how the team is using Unity to connect players in this MMORPG fantasy world.So what makes Pantheon: Rise of the Fallen unique compared to other MMO games?It’s definitely the social aspect. You have to experience the world and move through it naturally. It can be a bit more of a grind in a way, but it I think connects you more to your character, to the game, and the world instead of just sort of teleporting everywhere and joining LFG systems or just being placed in a dungeon. You learn the land a bit better, you have to navigate and you use your eyes more than just bouncing around like a pinball from objective to objective, following quest markers and stuff. It’s more of a thought game.How are you managing synchronization between the player experience and specific world instances?We have our own network library we built for the socket transport layer called ViNL. That’s the bread and butter for all of the zone communications, between zones and player to zone. SQL server in the back end, kind of standard stuff there. But most of the transports are handled by our own network library.How do you approach asset loading for this giant world?We’ve got a step where we bake our continents out into these tiles, and we’ve got different backends that we can plug into that. We’ve got one that just outputs standard Prefabs, and we’ve got one that outputs subscenes that we were using before Unity 6, and then we’ve got actual full-on Unity scenes that you can load additively, so you can choose how you want to output your content. Before Unity 6, we had moved away from Prefabs and started loading the DOTS subscenes and using that, built on BRG.We also have an output that can render directly to our own custom batch render group as well, just using scriptable objects and managing our own data. So we’ve been able to experiment and test out the different ones, and see what yields the best client performance. Prior to Unity 6, we were outputting and rendering the entire continent with subscenes, but with Unity 6 we actually switched back to using Prefabs with Instantiate Async and Addressables to manage everything.We’re using the Resident Drawer and GPU occlusion culling, which ended up yielding even better performance than subscenes and our own batch render group – I’m assuming because GPU occlusion culling just isn’t supported by some of the other render paths at the moment. So we’ve bounced around quite a bit, and we landed on Addressables for managing all the memory and asset loading, and regular Instantiate Prefabs with the GPU Resident Drawer seems to be the best client-side performance at the moment.Did you upgrade to Unity 6 to take advantage of the GPU Resident Drawer, specifically?Actually, I really wanted it for the occlusion culling. I wasn’t aware that only certain render paths made use of the occlusion culling, so we were attempting to use it with the same subscene rendering that we were using prior to Unity 6 and realizing nothing’s actually being culled. So we opted to switch back to the Prefab output to see what that looked like with the Resident Drawer, and occlusion culling and FPS went up.We had some issues initially, because Instantiate Async wasn’t in before Unity 6, so we had some stalls when we would instantiate our tiles. There were quite a few things being instantiated, but switching that over to Instantiate Async after we fixed a couple of bugs we got rid of the stall on load and the overall frame rate was higher after load, so it was just a win-win.Were there any really remarkable productivity gains that came with the switch to Unity 6?Everything I've talked about so far was client-facing, so our players experienced those wins. For the developer side of things, the stability and performance of the Editor went up quite a bit. The Editor stability in Unity 6 has gone up pretty substantially – it’s very rare to actually crash now. That alone has been, at least for the coding side, a huge win. It feels more stable in its entirety for sure.How do you handle making changes and updates without breaking everything?We build with Addressables using the labels very heavily, and we do the Addressable packaging by labels. So if we edit a specific zone or an asset in a zone, or like a VFX that’s associated with a spell or something like that, only those bundles that touch that label get updated at all.And then, our own content delivery system, we have the game available on Steam and our own patcher, and those both handle the delta changes, where we’re just delivering small updates through those Addressable bundles. The netcode requires the same version to be connected in the first place, so the network library side of that is automatically handled in the handshake process.What guidance would you give someone who’s trying to tackle an MMO game or another ambitious multiplayer project?You kind of start small, I guess. It's a step-by-step process. If you’re a small team, you You start small. It's a step-by-step process. If you’re a small team, you can’t bite off too much. It’d be completely overwhelming – but that holds true with any larger-scale game, not just an MMO. Probably technology selection – making smart choices upfront and sticking to them. It’s going to be a lot of middleware and backend tech that you’re going to have to wrangle and get working well together, and swapping to the newest cool thing all the time is not going to bode well.What’s the most exciting technical achievement for your team with this game?I think that there aren’t many open world MMOs, period, that have been pulled off in Unity. We don’t have a huge team, and we're making a game that is genuinely massive, so we have to focus on little isolated areas, develop them as best we can, and then move on and get feedback.The whole package together is fairly new grounds – when there is an MMO, it needs to feel like an MMO in spirit, with lots of people all around, doing their own thing. And we’ve pulled that off – I think better than pretty much any Unity MMO ever has. I think we can pat ourselves on the back for that.Get more insights from developers on Unity’s Resources page and here on the blog. Check out Pantheon: Rise of the Fallen in Early Access on Steam.
    #multiplayer #stack #behind #mmorpg #pantheon
    The multiplayer stack behind MMORPG Pantheon: Rise of the Fallen
    Finding your own path is at the core of gameplay in Pantheon: Rise of the Fallen – players can go anywhere, climb anything, forge new routes, and follow their curiosity to find adventure. It’s not that different from how its creators, Visionary Realms, approaches building this MMORPG – they’re doing it their own way.Transporting players to the fantasy world of Terminus, Pantheon: Rise of the Fallen harkens back to classic MMOs, where accidental discovery wandering through an open world and social interactions with other players are at the heart of the game experience.Creating any multiplayer game is a challenge – but a highly social online game at this scale is an epic quest. We sat down with lead programmer Kyle Olsen about how the team is using Unity to connect players in this MMORPG fantasy world.So what makes Pantheon: Rise of the Fallen unique compared to other MMO games?It’s definitely the social aspect. You have to experience the world and move through it naturally. It can be a bit more of a grind in a way, but it I think connects you more to your character, to the game, and the world instead of just sort of teleporting everywhere and joining LFG systems or just being placed in a dungeon. You learn the land a bit better, you have to navigate and you use your eyes more than just bouncing around like a pinball from objective to objective, following quest markers and stuff. It’s more of a thought game.How are you managing synchronization between the player experience and specific world instances?We have our own network library we built for the socket transport layer called ViNL. That’s the bread and butter for all of the zone communications, between zones and player to zone. SQL server in the back end, kind of standard stuff there. But most of the transports are handled by our own network library.How do you approach asset loading for this giant world?We’ve got a step where we bake our continents out into these tiles, and we’ve got different backends that we can plug into that. We’ve got one that just outputs standard Prefabs, and we’ve got one that outputs subscenes that we were using before Unity 6, and then we’ve got actual full-on Unity scenes that you can load additively, so you can choose how you want to output your content. Before Unity 6, we had moved away from Prefabs and started loading the DOTS subscenes and using that, built on BRG.We also have an output that can render directly to our own custom batch render group as well, just using scriptable objects and managing our own data. So we’ve been able to experiment and test out the different ones, and see what yields the best client performance. Prior to Unity 6, we were outputting and rendering the entire continent with subscenes, but with Unity 6 we actually switched back to using Prefabs with Instantiate Async and Addressables to manage everything.We’re using the Resident Drawer and GPU occlusion culling, which ended up yielding even better performance than subscenes and our own batch render group – I’m assuming because GPU occlusion culling just isn’t supported by some of the other render paths at the moment. So we’ve bounced around quite a bit, and we landed on Addressables for managing all the memory and asset loading, and regular Instantiate Prefabs with the GPU Resident Drawer seems to be the best client-side performance at the moment.Did you upgrade to Unity 6 to take advantage of the GPU Resident Drawer, specifically?Actually, I really wanted it for the occlusion culling. I wasn’t aware that only certain render paths made use of the occlusion culling, so we were attempting to use it with the same subscene rendering that we were using prior to Unity 6 and realizing nothing’s actually being culled. So we opted to switch back to the Prefab output to see what that looked like with the Resident Drawer, and occlusion culling and FPS went up.We had some issues initially, because Instantiate Async wasn’t in before Unity 6, so we had some stalls when we would instantiate our tiles. There were quite a few things being instantiated, but switching that over to Instantiate Async after we fixed a couple of bugs we got rid of the stall on load and the overall frame rate was higher after load, so it was just a win-win.Were there any really remarkable productivity gains that came with the switch to Unity 6?Everything I've talked about so far was client-facing, so our players experienced those wins. For the developer side of things, the stability and performance of the Editor went up quite a bit. The Editor stability in Unity 6 has gone up pretty substantially – it’s very rare to actually crash now. That alone has been, at least for the coding side, a huge win. It feels more stable in its entirety for sure.How do you handle making changes and updates without breaking everything?We build with Addressables using the labels very heavily, and we do the Addressable packaging by labels. So if we edit a specific zone or an asset in a zone, or like a VFX that’s associated with a spell or something like that, only those bundles that touch that label get updated at all.And then, our own content delivery system, we have the game available on Steam and our own patcher, and those both handle the delta changes, where we’re just delivering small updates through those Addressable bundles. The netcode requires the same version to be connected in the first place, so the network library side of that is automatically handled in the handshake process.What guidance would you give someone who’s trying to tackle an MMO game or another ambitious multiplayer project?You kind of start small, I guess. It's a step-by-step process. If you’re a small team, you You start small. It's a step-by-step process. If you’re a small team, you can’t bite off too much. It’d be completely overwhelming – but that holds true with any larger-scale game, not just an MMO. Probably technology selection – making smart choices upfront and sticking to them. It’s going to be a lot of middleware and backend tech that you’re going to have to wrangle and get working well together, and swapping to the newest cool thing all the time is not going to bode well.What’s the most exciting technical achievement for your team with this game?I think that there aren’t many open world MMOs, period, that have been pulled off in Unity. We don’t have a huge team, and we're making a game that is genuinely massive, so we have to focus on little isolated areas, develop them as best we can, and then move on and get feedback.The whole package together is fairly new grounds – when there is an MMO, it needs to feel like an MMO in spirit, with lots of people all around, doing their own thing. And we’ve pulled that off – I think better than pretty much any Unity MMO ever has. I think we can pat ourselves on the back for that.Get more insights from developers on Unity’s Resources page and here on the blog. Check out Pantheon: Rise of the Fallen in Early Access on Steam. #multiplayer #stack #behind #mmorpg #pantheon
    UNITY.COM
    The multiplayer stack behind MMORPG Pantheon: Rise of the Fallen
    Finding your own path is at the core of gameplay in Pantheon: Rise of the Fallen – players can go anywhere, climb anything, forge new routes, and follow their curiosity to find adventure. It’s not that different from how its creators, Visionary Realms, approaches building this MMORPG – they’re doing it their own way.Transporting players to the fantasy world of Terminus, Pantheon: Rise of the Fallen harkens back to classic MMOs, where accidental discovery wandering through an open world and social interactions with other players are at the heart of the game experience.Creating any multiplayer game is a challenge – but a highly social online game at this scale is an epic quest. We sat down with lead programmer Kyle Olsen about how the team is using Unity to connect players in this MMORPG fantasy world.So what makes Pantheon: Rise of the Fallen unique compared to other MMO games?It’s definitely the social aspect. You have to experience the world and move through it naturally. It can be a bit more of a grind in a way, but it I think connects you more to your character, to the game, and the world instead of just sort of teleporting everywhere and joining LFG systems or just being placed in a dungeon. You learn the land a bit better, you have to navigate and you use your eyes more than just bouncing around like a pinball from objective to objective, following quest markers and stuff. It’s more of a thought game.How are you managing synchronization between the player experience and specific world instances?We have our own network library we built for the socket transport layer called ViNL. That’s the bread and butter for all of the zone communications, between zones and player to zone. SQL server in the back end, kind of standard stuff there. But most of the transports are handled by our own network library.How do you approach asset loading for this giant world?We’ve got a step where we bake our continents out into these tiles, and we’ve got different backends that we can plug into that. We’ve got one that just outputs standard Prefabs, and we’ve got one that outputs subscenes that we were using before Unity 6, and then we’ve got actual full-on Unity scenes that you can load additively, so you can choose how you want to output your content. Before Unity 6, we had moved away from Prefabs and started loading the DOTS subscenes and using that, built on BRG.We also have an output that can render directly to our own custom batch render group as well, just using scriptable objects and managing our own data. So we’ve been able to experiment and test out the different ones, and see what yields the best client performance. Prior to Unity 6, we were outputting and rendering the entire continent with subscenes, but with Unity 6 we actually switched back to using Prefabs with Instantiate Async and Addressables to manage everything.We’re using the Resident Drawer and GPU occlusion culling, which ended up yielding even better performance than subscenes and our own batch render group – I’m assuming because GPU occlusion culling just isn’t supported by some of the other render paths at the moment. So we’ve bounced around quite a bit, and we landed on Addressables for managing all the memory and asset loading, and regular Instantiate Prefabs with the GPU Resident Drawer seems to be the best client-side performance at the moment.Did you upgrade to Unity 6 to take advantage of the GPU Resident Drawer, specifically?Actually, I really wanted it for the occlusion culling. I wasn’t aware that only certain render paths made use of the occlusion culling, so we were attempting to use it with the same subscene rendering that we were using prior to Unity 6 and realizing nothing’s actually being culled. So we opted to switch back to the Prefab output to see what that looked like with the Resident Drawer, and occlusion culling and FPS went up.We had some issues initially, because Instantiate Async wasn’t in before Unity 6, so we had some stalls when we would instantiate our tiles. There were quite a few things being instantiated, but switching that over to Instantiate Async after we fixed a couple of bugs we got rid of the stall on load and the overall frame rate was higher after load, so it was just a win-win.Were there any really remarkable productivity gains that came with the switch to Unity 6?Everything I've talked about so far was client-facing, so our players experienced those wins. For the developer side of things, the stability and performance of the Editor went up quite a bit. The Editor stability in Unity 6 has gone up pretty substantially – it’s very rare to actually crash now. That alone has been, at least for the coding side, a huge win. It feels more stable in its entirety for sure.How do you handle making changes and updates without breaking everything?We build with Addressables using the labels very heavily, and we do the Addressable packaging by labels. So if we edit a specific zone or an asset in a zone, or like a VFX that’s associated with a spell or something like that, only those bundles that touch that label get updated at all.And then, our own content delivery system, we have the game available on Steam and our own patcher, and those both handle the delta changes, where we’re just delivering small updates through those Addressable bundles. The netcode requires the same version to be connected in the first place, so the network library side of that is automatically handled in the handshake process.What guidance would you give someone who’s trying to tackle an MMO game or another ambitious multiplayer project?You kind of start small, I guess. It's a step-by-step process. If you’re a small team, you You start small. It's a step-by-step process. If you’re a small team, you can’t bite off too much. It’d be completely overwhelming – but that holds true with any larger-scale game, not just an MMO. Probably technology selection – making smart choices upfront and sticking to them. It’s going to be a lot of middleware and backend tech that you’re going to have to wrangle and get working well together, and swapping to the newest cool thing all the time is not going to bode well.What’s the most exciting technical achievement for your team with this game?I think that there aren’t many open world MMOs, period, that have been pulled off in Unity. We don’t have a huge team, and we're making a game that is genuinely massive, so we have to focus on little isolated areas, develop them as best we can, and then move on and get feedback.The whole package together is fairly new grounds – when there is an MMO, it needs to feel like an MMO in spirit, with lots of people all around, doing their own thing. And we’ve pulled that off – I think better than pretty much any Unity MMO ever has. I think we can pat ourselves on the back for that.Get more insights from developers on Unity’s Resources page and here on the blog. Check out Pantheon: Rise of the Fallen in Early Access on Steam.
    0 Yorumlar 0 hisse senetleri
  • Games Focus: Profiling and performance optimization

    This is the third blog in our Games Focus series, which highlights key product development initiatives for the year ahead and beyond. Here, we cover the status, upcoming release plans, and future vision for profiling and performance at Unity.My name is Marika. I’ve worked in the video game industry for nearly a decade, and I’m currently the senior technical product manager for profiling tools and performance optimization at Unity.When we think about performance at Unity, there are three main areas where we believe we can help:Insight: Empowering you to dig into your game’s performance, identify bottlenecks, and pinpoint areas that would benefit from optimization strategiesExperience: Ensuring that creating your projects feels seamless by raising the performance of the Unity Editor and runtimeInnovation: Guiding you in new programming techniques and paradigms that have performance in mind from the ground upToday’s post focuses on the first two areas, covering recent updates to our suite of profiling tools and how customer feedback is shaping our roadmap for 2023 and beyond. It ends with a recap on best practices for optimizing projects.We’ll dive into the third area, performance-focused programming techniques and workflows with a focus on DOTS-based projects, in an upcoming post.We like to think of the profiling features in Unity as detective tools that help you unravel the mysteries of why performance in your application is slow or glitchy, or why code is allocating excess memory. They help you understand what’s going on under the hood of the Unity game engine.Our goal is to raise the performance of Unity tools and runtime through profiling and optimization, helping you to deliver smooth performance for your players across a broad range of platforms and devices.Memory Profiler is designed to make it easier to keep track of memory usage and composition. I’m happy to share that the Memory Profiler 1.0.0 is now a verified package for the Unity 2022.2 beta release and above. Thank you to everyone who shared their invaluable feedback on how to create a better workflow for this important feature.Many of you contend with the challenge of working within the memory restrictions of each of your target platforms. The Memory Profiler helps solve this challenge by providing you with a clear overview of the memory impact of assets and objects in one view. It also shows you detailed contextual information on which objects and systems the memory relates to.You can dig deeper into the capture through breakdown views and compare memory snapshots to identify potential leaks and unnecessary allocations that negatively impact memory usage.Refining the existing profiling toolsetIn 2022.1, we added the Frame Timing Manager, which enables you to capture and access frame timing data across multiple frames. If performance is lagging, use this feature to assess frames and analyze why your application isn’t meeting performance targets. Learn more about this in our documentation.If you’re looking to monitor low-level GPU metrics in the Unity Profiler, you can use the new System Metrics Mali package, which we released in 2022.1 through a partnership with Arm. This package allows you to access low-level system or hardware metrics on mobile devices. If you’re curious to learn more about how to ensure your content runs smoothly on mobile devices powered by Arm CPUs and Mali GPUs, this 2021 blog can guide you.Performance optimizationThe profiling tools highlighted so far are a great start to helping you identify areas where performance can be improved. On my team, however, “performance optimization” applies not only to your games’ runtime performance on their target devices, but also to how your team works – your productivity. We’re aiming to provide you with faster iteration times, fewer interruptions, and greater efficiency in the Editor.In Unity 2021 LTS, importing your assets is three to four times faster, and opening imported projects up to 8.7% faster compared to Unity 2020 LTS.I’m excited to share some of the improvements that are available in the 2022 releases as well:Improved material reimport for the Universal Render Pipeline and High Definition Render PipelineEditor workflow improvements, including: Faster save time for large scenesReduced stall time in scene pickingImproved performance in the Scene view when there are many LOD GroupsAn optimized animation rigging packageBetter Hierarchy scrollingImproved save workflow for large PrefabsImproved iteration time when working inside the Editor thru optimizations on domain reloadsPlay mode improvements, including: Improved static batching performanceOptimized process for how Addressables finds resource directoriesPrewarming particle systemsAgain, your feedback has played a vital role in many of these improvements. Please continue sharing your feedback on our future roadmap here, or contact the team on the forums. We’re particularly interested in performance-related issues, which we’re capturing here.For over a decade, we’ve stayed focused on ensuring that you can achieve the best performance possible using our profiling tools, and we will continue refining the toolset. This development has taken many forms, including all of the functionality we’ve already mentioned here.Another area where we’ve worked to provide significant performance gains is the Data-Oriented Technology Stack, or DOTS. Two of the core features integral to the successful delivery of DOTS are the Burst compiler and C# Job System. These were leveraged in our own internal engine performance to great results, and they’re available for all today. Coming soon, we’ll deliver on the third critical feature, Entities, which will turbo boost project performance in areas like networking, physics, and more. This is such an important aspect to our commitment to game development that we will dedicate a standalone Games Focus article to DOTS in this series, coming soon.For now, let’s take a look at a few improvements planned for upcoming releases.We’re working to cut time spent starting the Editor, to improve start-up time and help you stay in flow. Today, when you connect a target device to the Editor, you might experience instability such as disconnection or an inability to recover. We’re working on making Editor connections to mobile platforms more reliable and performant in the 2023.1 release.Additionally, we want to make it more efficient for you to identify bottlenecks with the Profiler and to know what to do next once you’ve spotted them. Our goal is to quickly direct you to the areas of optimization that will yield the greatest performance gains.We’re also looking to add memory insights based on the device you’re building for, so you can get platform-specific performance gains. This is in the early stages, and we’re actively looking for your feedback on this new feature, which you can provide on our roadmap page.Expertise with Unity’s suite of profiling tools is one of the most useful skills you can add to your game development toolbox. That’s why we’re working on creating more advanced content about best practices to help you get the most out of our tools.Several of my teammates recently put together our most extensive guide to date about profiling in Unity, in partnership with expert engineers from the Unity Integrated Success team and experts.I also suggest you download these additional advanced e-books that offer extensive platform-specific optimization best practices:Optimize your mobile game performanceOptimize your console and PC game performanceAnother handy reference is this flowchart, which provides a recommended approach to identifying bottlenecks in your project.Finally, this Profiling and optimization reading list, created by our content and marketing teams, includes key blog posts that will help you understand profiling concepts and methods, from basic to advanced.My team is working hard to bring you the solutions you need for your most ambitious projects, and we’re always eager to understand how we can help you better.Stay tuned to updates in our public roadmap page. This is also the best place for you to share feedback directly with the product team.Watch the blog for our next Games Focus update, which will focus on what Unity is doing to help you target more platforms and form factors with your game content. And, as always, share your feedback with us on the forums.
    #games #focus #profiling #performance #optimization
    Games Focus: Profiling and performance optimization
    This is the third blog in our Games Focus series, which highlights key product development initiatives for the year ahead and beyond. Here, we cover the status, upcoming release plans, and future vision for profiling and performance at Unity.My name is Marika. I’ve worked in the video game industry for nearly a decade, and I’m currently the senior technical product manager for profiling tools and performance optimization at Unity.When we think about performance at Unity, there are three main areas where we believe we can help:Insight: Empowering you to dig into your game’s performance, identify bottlenecks, and pinpoint areas that would benefit from optimization strategiesExperience: Ensuring that creating your projects feels seamless by raising the performance of the Unity Editor and runtimeInnovation: Guiding you in new programming techniques and paradigms that have performance in mind from the ground upToday’s post focuses on the first two areas, covering recent updates to our suite of profiling tools and how customer feedback is shaping our roadmap for 2023 and beyond. It ends with a recap on best practices for optimizing projects.We’ll dive into the third area, performance-focused programming techniques and workflows with a focus on DOTS-based projects, in an upcoming post.We like to think of the profiling features in Unity as detective tools that help you unravel the mysteries of why performance in your application is slow or glitchy, or why code is allocating excess memory. They help you understand what’s going on under the hood of the Unity game engine.Our goal is to raise the performance of Unity tools and runtime through profiling and optimization, helping you to deliver smooth performance for your players across a broad range of platforms and devices.Memory Profiler is designed to make it easier to keep track of memory usage and composition. I’m happy to share that the Memory Profiler 1.0.0 is now a verified package for the Unity 2022.2 beta release and above. Thank you to everyone who shared their invaluable feedback on how to create a better workflow for this important feature.Many of you contend with the challenge of working within the memory restrictions of each of your target platforms. The Memory Profiler helps solve this challenge by providing you with a clear overview of the memory impact of assets and objects in one view. It also shows you detailed contextual information on which objects and systems the memory relates to.You can dig deeper into the capture through breakdown views and compare memory snapshots to identify potential leaks and unnecessary allocations that negatively impact memory usage.Refining the existing profiling toolsetIn 2022.1, we added the Frame Timing Manager, which enables you to capture and access frame timing data across multiple frames. If performance is lagging, use this feature to assess frames and analyze why your application isn’t meeting performance targets. Learn more about this in our documentation.If you’re looking to monitor low-level GPU metrics in the Unity Profiler, you can use the new System Metrics Mali package, which we released in 2022.1 through a partnership with Arm. This package allows you to access low-level system or hardware metrics on mobile devices. If you’re curious to learn more about how to ensure your content runs smoothly on mobile devices powered by Arm CPUs and Mali GPUs, this 2021 blog can guide you.Performance optimizationThe profiling tools highlighted so far are a great start to helping you identify areas where performance can be improved. On my team, however, “performance optimization” applies not only to your games’ runtime performance on their target devices, but also to how your team works – your productivity. We’re aiming to provide you with faster iteration times, fewer interruptions, and greater efficiency in the Editor.In Unity 2021 LTS, importing your assets is three to four times faster, and opening imported projects up to 8.7% faster compared to Unity 2020 LTS.I’m excited to share some of the improvements that are available in the 2022 releases as well:Improved material reimport for the Universal Render Pipeline and High Definition Render PipelineEditor workflow improvements, including: Faster save time for large scenesReduced stall time in scene pickingImproved performance in the Scene view when there are many LOD GroupsAn optimized animation rigging packageBetter Hierarchy scrollingImproved save workflow for large PrefabsImproved iteration time when working inside the Editor thru optimizations on domain reloadsPlay mode improvements, including: Improved static batching performanceOptimized process for how Addressables finds resource directoriesPrewarming particle systemsAgain, your feedback has played a vital role in many of these improvements. Please continue sharing your feedback on our future roadmap here, or contact the team on the forums. We’re particularly interested in performance-related issues, which we’re capturing here.For over a decade, we’ve stayed focused on ensuring that you can achieve the best performance possible using our profiling tools, and we will continue refining the toolset. This development has taken many forms, including all of the functionality we’ve already mentioned here.Another area where we’ve worked to provide significant performance gains is the Data-Oriented Technology Stack, or DOTS. Two of the core features integral to the successful delivery of DOTS are the Burst compiler and C# Job System. These were leveraged in our own internal engine performance to great results, and they’re available for all today. Coming soon, we’ll deliver on the third critical feature, Entities, which will turbo boost project performance in areas like networking, physics, and more. This is such an important aspect to our commitment to game development that we will dedicate a standalone Games Focus article to DOTS in this series, coming soon.For now, let’s take a look at a few improvements planned for upcoming releases.We’re working to cut time spent starting the Editor, to improve start-up time and help you stay in flow. Today, when you connect a target device to the Editor, you might experience instability such as disconnection or an inability to recover. We’re working on making Editor connections to mobile platforms more reliable and performant in the 2023.1 release.Additionally, we want to make it more efficient for you to identify bottlenecks with the Profiler and to know what to do next once you’ve spotted them. Our goal is to quickly direct you to the areas of optimization that will yield the greatest performance gains.We’re also looking to add memory insights based on the device you’re building for, so you can get platform-specific performance gains. This is in the early stages, and we’re actively looking for your feedback on this new feature, which you can provide on our roadmap page.Expertise with Unity’s suite of profiling tools is one of the most useful skills you can add to your game development toolbox. That’s why we’re working on creating more advanced content about best practices to help you get the most out of our tools.Several of my teammates recently put together our most extensive guide to date about profiling in Unity, in partnership with expert engineers from the Unity Integrated Success team and experts.I also suggest you download these additional advanced e-books that offer extensive platform-specific optimization best practices:Optimize your mobile game performanceOptimize your console and PC game performanceAnother handy reference is this flowchart, which provides a recommended approach to identifying bottlenecks in your project.Finally, this Profiling and optimization reading list, created by our content and marketing teams, includes key blog posts that will help you understand profiling concepts and methods, from basic to advanced.My team is working hard to bring you the solutions you need for your most ambitious projects, and we’re always eager to understand how we can help you better.Stay tuned to updates in our public roadmap page. This is also the best place for you to share feedback directly with the product team.Watch the blog for our next Games Focus update, which will focus on what Unity is doing to help you target more platforms and form factors with your game content. And, as always, share your feedback with us on the forums. #games #focus #profiling #performance #optimization
    UNITY.COM
    Games Focus: Profiling and performance optimization
    This is the third blog in our Games Focus series, which highlights key product development initiatives for the year ahead and beyond. Here, we cover the status, upcoming release plans, and future vision for profiling and performance at Unity.My name is Marika. I’ve worked in the video game industry for nearly a decade, and I’m currently the senior technical product manager for profiling tools and performance optimization at Unity.When we think about performance at Unity, there are three main areas where we believe we can help:Insight: Empowering you to dig into your game’s performance, identify bottlenecks, and pinpoint areas that would benefit from optimization strategiesExperience: Ensuring that creating your projects feels seamless by raising the performance of the Unity Editor and runtimeInnovation: Guiding you in new programming techniques and paradigms that have performance in mind from the ground upToday’s post focuses on the first two areas, covering recent updates to our suite of profiling tools and how customer feedback is shaping our roadmap for 2023 and beyond. It ends with a recap on best practices for optimizing projects.We’ll dive into the third area, performance-focused programming techniques and workflows with a focus on DOTS-based projects, in an upcoming post.We like to think of the profiling features in Unity as detective tools that help you unravel the mysteries of why performance in your application is slow or glitchy, or why code is allocating excess memory. They help you understand what’s going on under the hood of the Unity game engine.Our goal is to raise the performance of Unity tools and runtime through profiling and optimization, helping you to deliver smooth performance for your players across a broad range of platforms and devices.Memory Profiler is designed to make it easier to keep track of memory usage and composition. I’m happy to share that the Memory Profiler 1.0.0 is now a verified package for the Unity 2022.2 beta release and above (find instructions for download here). Thank you to everyone who shared their invaluable feedback on how to create a better workflow for this important feature.Many of you contend with the challenge of working within the memory restrictions of each of your target platforms. The Memory Profiler helps solve this challenge by providing you with a clear overview of the memory impact of assets and objects in one view. It also shows you detailed contextual information on which objects and systems the memory relates to.You can dig deeper into the capture through breakdown views and compare memory snapshots to identify potential leaks and unnecessary allocations that negatively impact memory usage.Refining the existing profiling toolsetIn 2022.1, we added the Frame Timing Manager, which enables you to capture and access frame timing data across multiple frames. If performance is lagging, use this feature to assess frames and analyze why your application isn’t meeting performance targets. Learn more about this in our documentation.If you’re looking to monitor low-level GPU metrics in the Unity Profiler, you can use the new System Metrics Mali package, which we released in 2022.1 through a partnership with Arm. This package allows you to access low-level system or hardware metrics on mobile devices. If you’re curious to learn more about how to ensure your content runs smoothly on mobile devices powered by Arm CPUs and Mali GPUs, this 2021 blog can guide you.Performance optimizationThe profiling tools highlighted so far are a great start to helping you identify areas where performance can be improved. On my team, however, “performance optimization” applies not only to your games’ runtime performance on their target devices, but also to how your team works – your productivity. We’re aiming to provide you with faster iteration times, fewer interruptions, and greater efficiency in the Editor.In Unity 2021 LTS, importing your assets is three to four times faster, and opening imported projects up to 8.7% faster compared to Unity 2020 LTS.I’m excited to share some of the improvements that are available in the 2022 releases as well:Improved material reimport for the Universal Render Pipeline and High Definition Render PipelineEditor workflow improvements, including: Faster save time for large scenesReduced stall time in scene pickingImproved performance in the Scene view when there are many LOD GroupsAn optimized animation rigging packageBetter Hierarchy scrollingImproved save workflow for large PrefabsImproved iteration time when working inside the Editor thru optimizations on domain reloadsPlay mode improvements, including: Improved static batching performanceOptimized process for how Addressables finds resource directoriesPrewarming particle systemsAgain, your feedback has played a vital role in many of these improvements. Please continue sharing your feedback on our future roadmap here, or contact the team on the forums. We’re particularly interested in performance-related issues, which we’re capturing here.For over a decade, we’ve stayed focused on ensuring that you can achieve the best performance possible using our profiling tools, and we will continue refining the toolset. This development has taken many forms, including all of the functionality we’ve already mentioned here.Another area where we’ve worked to provide significant performance gains is the Data-Oriented Technology Stack, or DOTS. Two of the core features integral to the successful delivery of DOTS are the Burst compiler and C# Job System. These were leveraged in our own internal engine performance to great results, and they’re available for all today. Coming soon, we’ll deliver on the third critical feature, Entities, which will turbo boost project performance in areas like networking, physics, and more. This is such an important aspect to our commitment to game development that we will dedicate a standalone Games Focus article to DOTS in this series, coming soon.For now, let’s take a look at a few improvements planned for upcoming releases.We’re working to cut time spent starting the Editor, to improve start-up time and help you stay in flow. Today, when you connect a target device to the Editor, you might experience instability such as disconnection or an inability to recover. We’re working on making Editor connections to mobile platforms more reliable and performant in the 2023.1 release.Additionally, we want to make it more efficient for you to identify bottlenecks with the Profiler and to know what to do next once you’ve spotted them. Our goal is to quickly direct you to the areas of optimization that will yield the greatest performance gains.We’re also looking to add memory insights based on the device you’re building for, so you can get platform-specific performance gains. This is in the early stages, and we’re actively looking for your feedback on this new feature, which you can provide on our roadmap page.Expertise with Unity’s suite of profiling tools is one of the most useful skills you can add to your game development toolbox. That’s why we’re working on creating more advanced content about best practices to help you get the most out of our tools.Several of my teammates recently put together our most extensive guide to date about profiling in Unity, in partnership with expert engineers from the Unity Integrated Success team and experts.I also suggest you download these additional advanced e-books that offer extensive platform-specific optimization best practices:Optimize your mobile game performanceOptimize your console and PC game performanceAnother handy reference is this flowchart, which provides a recommended approach to identifying bottlenecks in your project.Finally, this Profiling and optimization reading list, created by our content and marketing teams, includes key blog posts that will help you understand profiling concepts and methods, from basic to advanced.My team is working hard to bring you the solutions you need for your most ambitious projects, and we’re always eager to understand how we can help you better.Stay tuned to updates in our public roadmap page. This is also the best place for you to share feedback directly with the product team.Watch the blog for our next Games Focus update, which will focus on what Unity is doing to help you target more platforms and form factors with your game content. And, as always, share your feedback with us on the forums.
    0 Yorumlar 0 hisse senetleri
  • Addressables: Planning and best practices

    Games today are bigger than ever. As they continue to explore the limits of modern device hardware, it becomes increasingly critical for developers to manage content efficiently at runtime. And, as publishers look to optimize their games’ retention and monetization metrics, a small game client and dynamic over-the-air content updates have become baseline requirements for many successful games.Unity provides an end-to-end pipeline to help developers and publishers succeed in today’s gaming marketplace. That pipeline starts and ends with Addressables, a Unity package that launched in 2019 and now powers thousands of successful live games and tens of thousands more in development.The Addressables package provides a user interfaceand API for organizing Unity assets to be built into AssetBundles and loaded and unloaded dynamically at runtime. Whether AssetBundles are shipped with your base game or hosted and delivered from a remote content delivery networklike Cloud Content Delivery, Addressables helps you load the assets you need, only when you need them.While the Addressables system can simplify many aspects of content management, it’s not a “set it and forget it” feature. The choices you make about how to organize, build, load, and unload addressable assets have significant implications for your game’s size and performance.This guide explores some of the most important factors to consider so that you can get the most out of the Addressables system. At the end of this blog, you’ll find helpful “cheat sheets” that provide general settings and strategy recommendations based on common Addressables use cases.Of course, the best strategy will depend on the game you’re building and your goals. Treat this guide as a reference to be used together with Unity Learn materials, Unity Manual documentation, and the community-driven forum for Addressables.At its core, Addressables is a tool for building and working with AssetBundles. Before diving into the Addressables UI and API, it’s important to get familiar with the AssetBundles archive file format and some of the runtime implications.You can think of AssetBundles as containers – they are archive files built for your target platforms that can contain assets like models, textures, prefabs, ScriptableObjects, audio clips, and even entire scenes that Unity can load at runtime.A key feature of AssetBundles is that they can express dependencies between one another. For example, AssetBundle 1 might contain a prefab that depends on a texture in AssetBundle 2. When you use Addressables to load the prefab at runtime, the Addressables system will automatically load AssetBundle 2 and the dependent texture into memory. And, if AssetBundle 1 has another asset that depends on an asset in AssetBundle 3, AssetBundle 3 will also be loaded into memory, and so on.When your game is running, the Addressables system tracks active references for all assets – including dependent assets like the texture discussed above – to determine which ones need to be in memory. An asset loaded from an AssetBundle cannot be released from memory until both its reference count and all other asset reference counts in the same AssetBundle are at 0. The AssetBundle itself can be released from memory only when all asset reference counts in the AssetBundle are at 0.Keeping in mind this tight relationship between Addressables and AssetBundles, the most important rule when organizing your Addressables content is to create AssetBundles that contain discrete sets of assets that you expect to be loaded and unloaded together.The most important decision you’ll likely make while using Addressables is how to organize your assets into Addressables groups. Here are a few questions to consider:Should you create many small groups or a smaller number of large groups?For each group, how many AssetBundles should you aim to generate?Should you use labels?Should you give your groups local or remote load paths?While we would love to give a single answer, the best Addressables grouping strategy will depend on several factors that are specific to your game.Remember: Addressables groups provide the organizational structure for your addressable assets that determines how those assets will be built into AssetBundles. So the best organizational strategy will be the one that packs, loads, and unloads your AssetBundles most effectively based on your game’s unique structure, goals, and limitations.Before you start organizing your Addressables content, make sure you have a solid grasp on the following:1. Your game’s structure and roadmap2. Your game’s platform strengths and limitations3. Your primary goalin using Addressables to optimize your game’s performanceWe’ll tackle each of these factors below.The first factor to consider is your game’s structure and roadmap.By “structure,” we mean the actual architecture of your game. Is your game a linear, single-player journey where the player will progress through a predictable set of levels or environments? Is it a multiplatform PvP game with thousands of vanity items that could be instantiated at unpredictable times? Your game’s structure will determine when you will need to have assets loaded and ready to use, and when you’ll be able to unload assets and AssetBundles from memory.Remember, try to create AssetBundles that contain only the assets that need to be loaded together and can be unloaded together. If your game is a linear journey with distinct break points, consider organizing Addressables groups into larger subsets of content associated with each section of your game. That way, those assets can be loaded and unloaded together.If your game is non-linear and more unpredictable, opt for smaller groups that will generate smaller AssetBundles, allowing you to load and unload more dynamically. Always aim to use logical and meaningful names for your groups to help you quickly locate assets and optimize your layout.“Roadmap” refers to how your game will evolve over time. Once your game ships to players, will it remain mostly unchanged aside from occasional bug fixes or game balance patches? Or do you expect to add new content on a regular basis without requiring your players to install a large client update?Your content roadmap helps inform your grouping strategy. If your game’s content will be self-contained and not updated after launch, focus your grouping strategy around the structural considerations discussed above. If your game will require frequent content updates, group your content in a way that will allow players to download exactly what they need, when they need it.Consider using labels to help identify content from distinct bundles that will be needed together at runtime, such as a set of cosmetic items that will grow over time as your game matures. You can also use the “Pack Together By Label” Bundle Mode in your Groups Settings to subdivide content you’ve logically grouped together.For example, perhaps you plan to launch a new “Halloween 2023” event with some cosmetic items for players to collect. Your “Halloween 2023 Outfits” group might contain assets with the labels “Hats,” “Shoes,” and “Masks.” You could then add a “Halloween 2023” label to all the assets in this group. Using the “Pack Together By Label” Bundle Mode for this group will create three AssetBundles at build time.At runtime, you could then load all addressable assets with the Label “Hats” in your character customization screen to ensure all assets with that label are downloaded, loaded into memory, and ready for players to view. Or you could load all addressable assets with the label “Halloween 2023” on your promotional page for your event, ensuring they are ready to be displayed to your players.Having a deep understanding of your game’s structure and roadmap will help you make informed decisions about your content organization that will be beneficial throughout your game’s lifecycle.Next, we’ll tackle your platforms’ specific strengths and limitations and what they mean for your content strategy.The next factor to consider is the strengths and limitations of the platforms you’re targeting for distribution. In this section, we’ve outlined common platform targets for Addressables users, as well as some key considerations for each.Mobile and VRFor mobile and VR platforms, the most important considerations to keep in mind are app size, bundled content size, and download speeds.For your groups, consider the sets of content that your players will need immediately after install. Ensure this content is organized into groups with local load paths so that it will be included with your base game. Organize all other content into groups with remote load paths so that you can deliver this content over the air to your players.Opt for a group strategy that will build relatively small AssetBundles. The exact balance will depend on your game. Avoid extremely large bundles that will consume a substantial amount of memory and will be difficult to release once loaded. Similarly, avoid a huge number of tiny bundles that may create a very large Addressables catalog file that will be downloaded for every content update. Many tiny bundles can also have an impact on the speed at which your players can download the content they need, so be mindful of these pros and cons when determining the right balance for your game.Desktop and ConsolesFor desktop and consoles, the most important consideration is performance. Compared to mobile devices and wireless VR hardware, desktop and console hardware typically has fewer constraints around memory and disk storage. With this in mind, consider a group setting that will build uncompressed AssetBundles. This will provide the fastest possible loading time and can even provide for efficient patching on certain platforms.When developing for consoles specifically, pay close attention to any platform-specific caching restrictions that may apply. While mobile platforms allow you to take advantage of Unity’s AssetBundle Cache for downloaded content, this functionality is disabled by default at the Unity engine level for certain consoles and WebGL. Consider updating your base game with the new content on those platforms rather than attempting to deliver remote content over the air. Otherwise, you will need to create your own custom AssetBundle caching system and determine whether your solution complies with those platforms’ terms of service.After evaluating the strengths and limitations of your target platforms, identify one or two primary goals you’re trying to achieve by using the Addressables system. For example: Are you mainly aiming to reduce your base game’s size, or are you planning to deliver over-the-air content updates to players? To demonstrate, let’s discuss these options, and more, in detail below.Minimizing base game sizeIf your primary goal is to minimize your base game’s size, and you aren’t as concerned about memory limitations or large downloads after install, then your primary focus should be migrating as many assets as possible from scenes and Resources into one or more Addressables groups with remote load paths.Consider making the scenes in your project addressable and determine which, if any, must be included with the main player build. For those that can be delivered to players after install, include those scenes in groups with remote load paths. You can even build a player with one almost-empty scene, and load the rest of your game dynamically from there, as explained in this Open Projects Devlog video.If you make any scenes addressable, it’s best to make all of them addressable to reduce the chance and volume of unnecessary asset duplication.For groups that will generate AssetBundles to be hosted remotely, be sure to enable the AssetBundle Cache. This setting will ensure that downloaded AssetBundles will be cached on your players’ devices, preventing them from having to redownload each session.While it’s always good to keep in mind the runtime implications of many small bundles versus few large bundles, these considerations become more relevant when considering other goals you may have.Efficiently delivering remote content to playersIf your primary goal is the efficient delivery of remote content, your group structure should reflect how you aim to split content between “local”and “remote” content. Again, be sure to enable the AssetBundle Cache to cache downloaded content on players’ devices.The size, number, and Bundle Mode of these groups will depend on when you expect to deliver remote content to your players and how long you’re willing to let them wait for downloads to complete. For example, if your game’s structure will allow for delivery of all remote content shortly after they install the base game, you can opt for larger groups with Pack Together or Pack Together By Label, which will result in a small number of large downloads.If you expect to deliver smaller sets of remote content to players throughout their sessions that will be less disruptive to the experience, you can opt for smaller groups and/or a Bundle Mode setting that will generate smaller AssetBundles that will download much more quickly.In most cases, for groups containing remote content, consider Enabled, Excluding Cached for your AssetBundle Cyclic Redundancy Checkoption. This will provide additional assurances of your remote content’s integrity as it’s being cached to players’ devices, while avoiding the additional overhead of performing a CRC for loading content that’s already on player devices.Optimizing runtime memory usage and performanceIf your primary goal is optimizing the game’s runtime performance and memory usage, remember the most important rule of Addressables groups organization: Assets that you plan to load and unload at the same time should be grouped together.Generally speaking, this will mean creating smaller AssetBundles. You can achieve this in several ways, including creating smaller groups and/or avoiding the “Pack Together” Bundle Mode in your Group Settings for large groups that contain assets that won’t always be needed at the same time in your game.You should also keep an eye on runtime performance to help you spot potential issues or areas of optimization. Take advantage of official Unity tools like the Unity Profiler, the Memory Profiler package, or the Addressables Event Viewer, which can all help optimize your game’s performance.Be on the lookout for the upcoming Addressables Profiler Module, which will replace the Addressables Event Viewer. This new tool will provide even more in-depth information about how your code is loading and unloading addressable assets and AssetBundles, including detailed information about dependencies among your assets and AssetBundles.Multiple goalsOf course, most projects will have a number of goals associated with Addressables. In this case, there is truly no one-size-fits-all approach. You will need to evaluate the tradeoffs outlined above and find the group structure and settings that will best achieve the success you’ve defined.We recommend that you take advantage of the Addressables Build Report and the Addressables Profiler Module, available soon in Addressables 1.21.3. The Addressables Build Report will provide you with detailed information about the AssetBundles that were generated from your Addressables builds, including file size, potential duplicates, and in-depth dependency information. The Addressables Profiler Module is a new runtime analysis tool that takes advantage of this new dependency data, providing precise information about what was loaded by your Addressables code and why it was loaded.Below we’ve provided some handy “cheat sheets” for our recommended Addressables settings and strategies based on some of the most common use cases. Of course, these are just suggestions – it’s up to you to determine whether a suggestion aligns with your project’s unique structure and your specific goals.A mobile game with frequent content updatesA standalone, self-contained desktop or console gameA VR game built for Meta Quest 2If you have questions or want to learn more about the Addressables package, visit us in the Addressables forum. You can also connect with me directly on Twitter at @Unity_Jeff. Be sure to watch for new technical blogs from other Unity developers as part of the ongoing Tech from the Trenches series.
    #addressables #planning #best #practices
    Addressables: Planning and best practices
    Games today are bigger than ever. As they continue to explore the limits of modern device hardware, it becomes increasingly critical for developers to manage content efficiently at runtime. And, as publishers look to optimize their games’ retention and monetization metrics, a small game client and dynamic over-the-air content updates have become baseline requirements for many successful games.Unity provides an end-to-end pipeline to help developers and publishers succeed in today’s gaming marketplace. That pipeline starts and ends with Addressables, a Unity package that launched in 2019 and now powers thousands of successful live games and tens of thousands more in development.The Addressables package provides a user interfaceand API for organizing Unity assets to be built into AssetBundles and loaded and unloaded dynamically at runtime. Whether AssetBundles are shipped with your base game or hosted and delivered from a remote content delivery networklike Cloud Content Delivery, Addressables helps you load the assets you need, only when you need them.While the Addressables system can simplify many aspects of content management, it’s not a “set it and forget it” feature. The choices you make about how to organize, build, load, and unload addressable assets have significant implications for your game’s size and performance.This guide explores some of the most important factors to consider so that you can get the most out of the Addressables system. At the end of this blog, you’ll find helpful “cheat sheets” that provide general settings and strategy recommendations based on common Addressables use cases.Of course, the best strategy will depend on the game you’re building and your goals. Treat this guide as a reference to be used together with Unity Learn materials, Unity Manual documentation, and the community-driven forum for Addressables.At its core, Addressables is a tool for building and working with AssetBundles. Before diving into the Addressables UI and API, it’s important to get familiar with the AssetBundles archive file format and some of the runtime implications.You can think of AssetBundles as containers – they are archive files built for your target platforms that can contain assets like models, textures, prefabs, ScriptableObjects, audio clips, and even entire scenes that Unity can load at runtime.A key feature of AssetBundles is that they can express dependencies between one another. For example, AssetBundle 1 might contain a prefab that depends on a texture in AssetBundle 2. When you use Addressables to load the prefab at runtime, the Addressables system will automatically load AssetBundle 2 and the dependent texture into memory. And, if AssetBundle 1 has another asset that depends on an asset in AssetBundle 3, AssetBundle 3 will also be loaded into memory, and so on.When your game is running, the Addressables system tracks active references for all assets – including dependent assets like the texture discussed above – to determine which ones need to be in memory. An asset loaded from an AssetBundle cannot be released from memory until both its reference count and all other asset reference counts in the same AssetBundle are at 0. The AssetBundle itself can be released from memory only when all asset reference counts in the AssetBundle are at 0.Keeping in mind this tight relationship between Addressables and AssetBundles, the most important rule when organizing your Addressables content is to create AssetBundles that contain discrete sets of assets that you expect to be loaded and unloaded together.The most important decision you’ll likely make while using Addressables is how to organize your assets into Addressables groups. Here are a few questions to consider:Should you create many small groups or a smaller number of large groups?For each group, how many AssetBundles should you aim to generate?Should you use labels?Should you give your groups local or remote load paths?While we would love to give a single answer, the best Addressables grouping strategy will depend on several factors that are specific to your game.Remember: Addressables groups provide the organizational structure for your addressable assets that determines how those assets will be built into AssetBundles. So the best organizational strategy will be the one that packs, loads, and unloads your AssetBundles most effectively based on your game’s unique structure, goals, and limitations.Before you start organizing your Addressables content, make sure you have a solid grasp on the following:1. Your game’s structure and roadmap2. Your game’s platform strengths and limitations3. Your primary goalin using Addressables to optimize your game’s performanceWe’ll tackle each of these factors below.The first factor to consider is your game’s structure and roadmap.By “structure,” we mean the actual architecture of your game. Is your game a linear, single-player journey where the player will progress through a predictable set of levels or environments? Is it a multiplatform PvP game with thousands of vanity items that could be instantiated at unpredictable times? Your game’s structure will determine when you will need to have assets loaded and ready to use, and when you’ll be able to unload assets and AssetBundles from memory.Remember, try to create AssetBundles that contain only the assets that need to be loaded together and can be unloaded together. If your game is a linear journey with distinct break points, consider organizing Addressables groups into larger subsets of content associated with each section of your game. That way, those assets can be loaded and unloaded together.If your game is non-linear and more unpredictable, opt for smaller groups that will generate smaller AssetBundles, allowing you to load and unload more dynamically. Always aim to use logical and meaningful names for your groups to help you quickly locate assets and optimize your layout.“Roadmap” refers to how your game will evolve over time. Once your game ships to players, will it remain mostly unchanged aside from occasional bug fixes or game balance patches? Or do you expect to add new content on a regular basis without requiring your players to install a large client update?Your content roadmap helps inform your grouping strategy. If your game’s content will be self-contained and not updated after launch, focus your grouping strategy around the structural considerations discussed above. If your game will require frequent content updates, group your content in a way that will allow players to download exactly what they need, when they need it.Consider using labels to help identify content from distinct bundles that will be needed together at runtime, such as a set of cosmetic items that will grow over time as your game matures. You can also use the “Pack Together By Label” Bundle Mode in your Groups Settings to subdivide content you’ve logically grouped together.For example, perhaps you plan to launch a new “Halloween 2023” event with some cosmetic items for players to collect. Your “Halloween 2023 Outfits” group might contain assets with the labels “Hats,” “Shoes,” and “Masks.” You could then add a “Halloween 2023” label to all the assets in this group. Using the “Pack Together By Label” Bundle Mode for this group will create three AssetBundles at build time.At runtime, you could then load all addressable assets with the Label “Hats” in your character customization screen to ensure all assets with that label are downloaded, loaded into memory, and ready for players to view. Or you could load all addressable assets with the label “Halloween 2023” on your promotional page for your event, ensuring they are ready to be displayed to your players.Having a deep understanding of your game’s structure and roadmap will help you make informed decisions about your content organization that will be beneficial throughout your game’s lifecycle.Next, we’ll tackle your platforms’ specific strengths and limitations and what they mean for your content strategy.The next factor to consider is the strengths and limitations of the platforms you’re targeting for distribution. In this section, we’ve outlined common platform targets for Addressables users, as well as some key considerations for each.Mobile and VRFor mobile and VR platforms, the most important considerations to keep in mind are app size, bundled content size, and download speeds.For your groups, consider the sets of content that your players will need immediately after install. Ensure this content is organized into groups with local load paths so that it will be included with your base game. Organize all other content into groups with remote load paths so that you can deliver this content over the air to your players.Opt for a group strategy that will build relatively small AssetBundles. The exact balance will depend on your game. Avoid extremely large bundles that will consume a substantial amount of memory and will be difficult to release once loaded. Similarly, avoid a huge number of tiny bundles that may create a very large Addressables catalog file that will be downloaded for every content update. Many tiny bundles can also have an impact on the speed at which your players can download the content they need, so be mindful of these pros and cons when determining the right balance for your game.Desktop and ConsolesFor desktop and consoles, the most important consideration is performance. Compared to mobile devices and wireless VR hardware, desktop and console hardware typically has fewer constraints around memory and disk storage. With this in mind, consider a group setting that will build uncompressed AssetBundles. This will provide the fastest possible loading time and can even provide for efficient patching on certain platforms.When developing for consoles specifically, pay close attention to any platform-specific caching restrictions that may apply. While mobile platforms allow you to take advantage of Unity’s AssetBundle Cache for downloaded content, this functionality is disabled by default at the Unity engine level for certain consoles and WebGL. Consider updating your base game with the new content on those platforms rather than attempting to deliver remote content over the air. Otherwise, you will need to create your own custom AssetBundle caching system and determine whether your solution complies with those platforms’ terms of service.After evaluating the strengths and limitations of your target platforms, identify one or two primary goals you’re trying to achieve by using the Addressables system. For example: Are you mainly aiming to reduce your base game’s size, or are you planning to deliver over-the-air content updates to players? To demonstrate, let’s discuss these options, and more, in detail below.Minimizing base game sizeIf your primary goal is to minimize your base game’s size, and you aren’t as concerned about memory limitations or large downloads after install, then your primary focus should be migrating as many assets as possible from scenes and Resources into one or more Addressables groups with remote load paths.Consider making the scenes in your project addressable and determine which, if any, must be included with the main player build. For those that can be delivered to players after install, include those scenes in groups with remote load paths. You can even build a player with one almost-empty scene, and load the rest of your game dynamically from there, as explained in this Open Projects Devlog video.If you make any scenes addressable, it’s best to make all of them addressable to reduce the chance and volume of unnecessary asset duplication.For groups that will generate AssetBundles to be hosted remotely, be sure to enable the AssetBundle Cache. This setting will ensure that downloaded AssetBundles will be cached on your players’ devices, preventing them from having to redownload each session.While it’s always good to keep in mind the runtime implications of many small bundles versus few large bundles, these considerations become more relevant when considering other goals you may have.Efficiently delivering remote content to playersIf your primary goal is the efficient delivery of remote content, your group structure should reflect how you aim to split content between “local”and “remote” content. Again, be sure to enable the AssetBundle Cache to cache downloaded content on players’ devices.The size, number, and Bundle Mode of these groups will depend on when you expect to deliver remote content to your players and how long you’re willing to let them wait for downloads to complete. For example, if your game’s structure will allow for delivery of all remote content shortly after they install the base game, you can opt for larger groups with Pack Together or Pack Together By Label, which will result in a small number of large downloads.If you expect to deliver smaller sets of remote content to players throughout their sessions that will be less disruptive to the experience, you can opt for smaller groups and/or a Bundle Mode setting that will generate smaller AssetBundles that will download much more quickly.In most cases, for groups containing remote content, consider Enabled, Excluding Cached for your AssetBundle Cyclic Redundancy Checkoption. This will provide additional assurances of your remote content’s integrity as it’s being cached to players’ devices, while avoiding the additional overhead of performing a CRC for loading content that’s already on player devices.Optimizing runtime memory usage and performanceIf your primary goal is optimizing the game’s runtime performance and memory usage, remember the most important rule of Addressables groups organization: Assets that you plan to load and unload at the same time should be grouped together.Generally speaking, this will mean creating smaller AssetBundles. You can achieve this in several ways, including creating smaller groups and/or avoiding the “Pack Together” Bundle Mode in your Group Settings for large groups that contain assets that won’t always be needed at the same time in your game.You should also keep an eye on runtime performance to help you spot potential issues or areas of optimization. Take advantage of official Unity tools like the Unity Profiler, the Memory Profiler package, or the Addressables Event Viewer, which can all help optimize your game’s performance.Be on the lookout for the upcoming Addressables Profiler Module, which will replace the Addressables Event Viewer. This new tool will provide even more in-depth information about how your code is loading and unloading addressable assets and AssetBundles, including detailed information about dependencies among your assets and AssetBundles.Multiple goalsOf course, most projects will have a number of goals associated with Addressables. In this case, there is truly no one-size-fits-all approach. You will need to evaluate the tradeoffs outlined above and find the group structure and settings that will best achieve the success you’ve defined.We recommend that you take advantage of the Addressables Build Report and the Addressables Profiler Module, available soon in Addressables 1.21.3. The Addressables Build Report will provide you with detailed information about the AssetBundles that were generated from your Addressables builds, including file size, potential duplicates, and in-depth dependency information. The Addressables Profiler Module is a new runtime analysis tool that takes advantage of this new dependency data, providing precise information about what was loaded by your Addressables code and why it was loaded.Below we’ve provided some handy “cheat sheets” for our recommended Addressables settings and strategies based on some of the most common use cases. Of course, these are just suggestions – it’s up to you to determine whether a suggestion aligns with your project’s unique structure and your specific goals.A mobile game with frequent content updatesA standalone, self-contained desktop or console gameA VR game built for Meta Quest 2If you have questions or want to learn more about the Addressables package, visit us in the Addressables forum. You can also connect with me directly on Twitter at @Unity_Jeff. Be sure to watch for new technical blogs from other Unity developers as part of the ongoing Tech from the Trenches series. #addressables #planning #best #practices
    UNITY.COM
    Addressables: Planning and best practices
    Games today are bigger than ever. As they continue to explore the limits of modern device hardware, it becomes increasingly critical for developers to manage content efficiently at runtime. And, as publishers look to optimize their games’ retention and monetization metrics, a small game client and dynamic over-the-air content updates have become baseline requirements for many successful games.Unity provides an end-to-end pipeline to help developers and publishers succeed in today’s gaming marketplace. That pipeline starts and ends with Addressables, a Unity package that launched in 2019 and now powers thousands of successful live games and tens of thousands more in development.The Addressables package provides a user interface (UI) and API for organizing Unity assets to be built into AssetBundles and loaded and unloaded dynamically at runtime. Whether AssetBundles are shipped with your base game or hosted and delivered from a remote content delivery network (CDN) like Cloud Content Delivery, Addressables helps you load the assets you need, only when you need them.While the Addressables system can simplify many aspects of content management, it’s not a “set it and forget it” feature. The choices you make about how to organize, build, load, and unload addressable assets have significant implications for your game’s size and performance.This guide explores some of the most important factors to consider so that you can get the most out of the Addressables system. At the end of this blog, you’ll find helpful “cheat sheets” that provide general settings and strategy recommendations based on common Addressables use cases.Of course, the best strategy will depend on the game you’re building and your goals. Treat this guide as a reference to be used together with Unity Learn materials, Unity Manual documentation, and the community-driven forum for Addressables.At its core, Addressables is a tool for building and working with AssetBundles. Before diving into the Addressables UI and API, it’s important to get familiar with the AssetBundles archive file format and some of the runtime implications.You can think of AssetBundles as containers – they are archive files built for your target platforms that can contain assets like models, textures, prefabs, ScriptableObjects, audio clips, and even entire scenes that Unity can load at runtime.A key feature of AssetBundles is that they can express dependencies between one another. For example, AssetBundle 1 might contain a prefab that depends on a texture in AssetBundle 2. When you use Addressables to load the prefab at runtime, the Addressables system will automatically load AssetBundle 2 and the dependent texture into memory. And, if AssetBundle 1 has another asset that depends on an asset in AssetBundle 3, AssetBundle 3 will also be loaded into memory, and so on.When your game is running, the Addressables system tracks active references for all assets – including dependent assets like the texture discussed above – to determine which ones need to be in memory. An asset loaded from an AssetBundle cannot be released from memory until both its reference count and all other asset reference counts in the same AssetBundle are at 0. The AssetBundle itself can be released from memory only when all asset reference counts in the AssetBundle are at 0.Keeping in mind this tight relationship between Addressables and AssetBundles, the most important rule when organizing your Addressables content is to create AssetBundles that contain discrete sets of assets that you expect to be loaded and unloaded together.The most important decision you’ll likely make while using Addressables is how to organize your assets into Addressables groups. Here are a few questions to consider:Should you create many small groups or a smaller number of large groups?For each group, how many AssetBundles should you aim to generate (i.e., should you pack the assets in that group together, separately, or by label)?Should you use labels?Should you give your groups local or remote load paths?While we would love to give a single answer, the best Addressables grouping strategy will depend on several factors that are specific to your game.Remember: Addressables groups provide the organizational structure for your addressable assets that determines how those assets will be built into AssetBundles. So the best organizational strategy will be the one that packs, loads, and unloads your AssetBundles most effectively based on your game’s unique structure, goals, and limitations.Before you start organizing your Addressables content, make sure you have a solid grasp on the following:1. Your game’s structure and roadmap2. Your game’s platform strengths and limitations3. Your primary goal(s) in using Addressables to optimize your game’s performanceWe’ll tackle each of these factors below.The first factor to consider is your game’s structure and roadmap.By “structure,” we mean the actual architecture of your game. Is your game a linear, single-player journey where the player will progress through a predictable set of levels or environments? Is it a multiplatform PvP game with thousands of vanity items that could be instantiated at unpredictable times? Your game’s structure will determine when you will need to have assets loaded and ready to use, and when you’ll be able to unload assets and AssetBundles from memory.Remember, try to create AssetBundles that contain only the assets that need to be loaded together and can be unloaded together. If your game is a linear journey with distinct break points, consider organizing Addressables groups into larger subsets of content associated with each section of your game. That way, those assets can be loaded and unloaded together.If your game is non-linear and more unpredictable, opt for smaller groups that will generate smaller AssetBundles, allowing you to load and unload more dynamically. Always aim to use logical and meaningful names for your groups to help you quickly locate assets and optimize your layout.“Roadmap” refers to how your game will evolve over time. Once your game ships to players, will it remain mostly unchanged aside from occasional bug fixes or game balance patches? Or do you expect to add new content on a regular basis without requiring your players to install a large client update?Your content roadmap helps inform your grouping strategy. If your game’s content will be self-contained and not updated after launch, focus your grouping strategy around the structural considerations discussed above. If your game will require frequent content updates, group your content in a way that will allow players to download exactly what they need, when they need it.Consider using labels to help identify content from distinct bundles that will be needed together at runtime, such as a set of cosmetic items that will grow over time as your game matures. You can also use the “Pack Together By Label” Bundle Mode in your Groups Settings to subdivide content you’ve logically grouped together.For example, perhaps you plan to launch a new “Halloween 2023” event with some cosmetic items for players to collect. Your “Halloween 2023 Outfits” group might contain assets with the labels “Hats,” “Shoes,” and “Masks.” You could then add a “Halloween 2023” label to all the assets in this group. Using the “Pack Together By Label” Bundle Mode for this group will create three AssetBundles at build time.At runtime, you could then load all addressable assets with the Label “Hats” in your character customization screen to ensure all assets with that label are downloaded, loaded into memory, and ready for players to view. Or you could load all addressable assets with the label “Halloween 2023” on your promotional page for your event, ensuring they are ready to be displayed to your players.Having a deep understanding of your game’s structure and roadmap will help you make informed decisions about your content organization that will be beneficial throughout your game’s lifecycle.Next, we’ll tackle your platforms’ specific strengths and limitations and what they mean for your content strategy.The next factor to consider is the strengths and limitations of the platforms you’re targeting for distribution. In this section, we’ve outlined common platform targets for Addressables users, as well as some key considerations for each.Mobile and VRFor mobile and VR platforms, the most important considerations to keep in mind are app size, bundled content size, and download speeds.For your groups, consider the sets of content that your players will need immediately after install (e.g., to be able to complete your tutorial). Ensure this content is organized into groups with local load paths so that it will be included with your base game. Organize all other content into groups with remote load paths so that you can deliver this content over the air to your players.Opt for a group strategy that will build relatively small AssetBundles. The exact balance will depend on your game. Avoid extremely large bundles that will consume a substantial amount of memory and will be difficult to release once loaded. Similarly, avoid a huge number of tiny bundles that may create a very large Addressables catalog file that will be downloaded for every content update. Many tiny bundles can also have an impact on the speed at which your players can download the content they need, so be mindful of these pros and cons when determining the right balance for your game.Desktop and ConsolesFor desktop and consoles, the most important consideration is performance. Compared to mobile devices and wireless VR hardware, desktop and console hardware typically has fewer constraints around memory and disk storage. With this in mind, consider a group setting that will build uncompressed AssetBundles. This will provide the fastest possible loading time and can even provide for efficient patching on certain platforms.When developing for consoles specifically, pay close attention to any platform-specific caching restrictions that may apply. While mobile platforms allow you to take advantage of Unity’s AssetBundle Cache for downloaded content, this functionality is disabled by default at the Unity engine level for certain consoles and WebGL. Consider updating your base game with the new content on those platforms rather than attempting to deliver remote content over the air. Otherwise, you will need to create your own custom AssetBundle caching system and determine whether your solution complies with those platforms’ terms of service.After evaluating the strengths and limitations of your target platforms, identify one or two primary goals you’re trying to achieve by using the Addressables system. For example: Are you mainly aiming to reduce your base game’s size, or are you planning to deliver over-the-air content updates to players? To demonstrate, let’s discuss these options, and more, in detail below.Minimizing base game sizeIf your primary goal is to minimize your base game’s size, and you aren’t as concerned about memory limitations or large downloads after install, then your primary focus should be migrating as many assets as possible from scenes and Resources into one or more Addressables groups with remote load paths.Consider making the scenes in your project addressable and determine which, if any, must be included with the main player build. For those that can be delivered to players after install, include those scenes in groups with remote load paths. You can even build a player with one almost-empty scene, and load the rest of your game dynamically from there, as explained in this Open Projects Devlog video.If you make any scenes addressable, it’s best to make all of them addressable to reduce the chance and volume of unnecessary asset duplication.For groups that will generate AssetBundles to be hosted remotely, be sure to enable the AssetBundle Cache. This setting will ensure that downloaded AssetBundles will be cached on your players’ devices, preventing them from having to redownload each session.While it’s always good to keep in mind the runtime implications of many small bundles versus few large bundles, these considerations become more relevant when considering other goals you may have.Efficiently delivering remote content to playersIf your primary goal is the efficient delivery of remote content, your group structure should reflect how you aim to split content between “local” (i.e., assets included with your player build) and “remote” content (i.e., assets hosted on an external content delivery network). Again, be sure to enable the AssetBundle Cache to cache downloaded content on players’ devices.The size, number, and Bundle Mode of these groups will depend on when you expect to deliver remote content to your players and how long you’re willing to let them wait for downloads to complete. For example, if your game’s structure will allow for delivery of all remote content shortly after they install the base game, you can opt for larger groups with Pack Together or Pack Together By Label, which will result in a small number of large downloads.If you expect to deliver smaller sets of remote content to players throughout their sessions that will be less disruptive to the experience, you can opt for smaller groups and/or a Bundle Mode setting that will generate smaller AssetBundles that will download much more quickly.In most cases, for groups containing remote content, consider Enabled, Excluding Cached for your AssetBundle Cyclic Redundancy Check (CRC) option. This will provide additional assurances of your remote content’s integrity as it’s being cached to players’ devices, while avoiding the additional overhead of performing a CRC for loading content that’s already on player devices.Optimizing runtime memory usage and performanceIf your primary goal is optimizing the game’s runtime performance and memory usage, remember the most important rule of Addressables groups organization: Assets that you plan to load and unload at the same time should be grouped together.Generally speaking, this will mean creating smaller AssetBundles. You can achieve this in several ways, including creating smaller groups and/or avoiding the “Pack Together” Bundle Mode in your Group Settings for large groups that contain assets that won’t always be needed at the same time in your game.You should also keep an eye on runtime performance to help you spot potential issues or areas of optimization. Take advantage of official Unity tools like the Unity Profiler, the Memory Profiler package, or the Addressables Event Viewer, which can all help optimize your game’s performance.Be on the lookout for the upcoming Addressables Profiler Module, which will replace the Addressables Event Viewer. This new tool will provide even more in-depth information about how your code is loading and unloading addressable assets and AssetBundles, including detailed information about dependencies among your assets and AssetBundles.Multiple goalsOf course, most projects will have a number of goals associated with Addressables. In this case, there is truly no one-size-fits-all approach. You will need to evaluate the tradeoffs outlined above and find the group structure and settings that will best achieve the success you’ve defined.We recommend that you take advantage of the Addressables Build Report and the Addressables Profiler Module, available soon in Addressables 1.21.3. The Addressables Build Report will provide you with detailed information about the AssetBundles that were generated from your Addressables builds, including file size, potential duplicates, and in-depth dependency information. The Addressables Profiler Module is a new runtime analysis tool that takes advantage of this new dependency data, providing precise information about what was loaded by your Addressables code and why it was loaded.Below we’ve provided some handy “cheat sheets” for our recommended Addressables settings and strategies based on some of the most common use cases. Of course, these are just suggestions – it’s up to you to determine whether a suggestion aligns with your project’s unique structure and your specific goals.A mobile game with frequent content updatesA standalone, self-contained desktop or console gameA VR game built for Meta Quest 2If you have questions or want to learn more about the Addressables package, visit us in the Addressables forum. You can also connect with me directly on Twitter at @Unity_Jeff. Be sure to watch for new technical blogs from other Unity developers as part of the ongoing Tech from the Trenches series.
    0 Yorumlar 0 hisse senetleri
  • Extended Q&A: Optimizing memory and build size with Addressables

    In February, as part of my role as a senior software development consultant for Unity Accelerate Solutions, I led a technical webinar about the Addressables Asset System. During the live session, I demonstrated various profiling tools that you can use to optimize a project’s runtime memory and build size. The webinar ended with a Q&A, and our team received more questions than we had time to answer.The following is an extension of that closing Q&A, so we can answer more of your questions.Q: Is the Addressables system needed for light games – like casual, arcade, or puzzle games – if I don’t have memory issues?
    A: Maybe not, but it’s good to keep in mind that the Addressables system doesn’t only improve memory performance. Having the ability to choose when you load content can improve loading times. Building content in Addressables enables you to have iterative builds that don’t take as long. For example, if you make a small script change, you may not have to rebuild all of your bundles.Q: Are loaded assets released when the scene switches?
    A: Potentially. Loaded assets from Addressables that are ready to be released because they have a ref count of zero might be unloaded from memory during a scene transition. When transitioning from scenes non-additively, call Resources.UnloadUnusedAssets. This is expensive on the CPU, but allows you to partially unload AssetBundles.Q: Do object pooling and Addressables work well together?
    A: Yes. You can load your object once from Addressables and then instantiate multiple copies of it to create your pool. When you are done with the pool, destroy all the objects and release the AsyncOperationHandle that was used to load the asset.Q: Are groups and bundles loaded into memory all at once?
    A: Addressables groups are an Editor-only concept. At runtime, you only deal with bundles. Bundles are loaded into memory only when they are needed and only the desired content is loaded.Example: You have one bundle with 10 characters in it. You ask Addressables to load three characters. The bundle’s metadata and the three characters will be loaded.Q: If I want to release an asset, do I need to keep the AsyncOperationHandle or the AssetReference?
    A: We recommend keeping the handle and using it, since you’re responsible for releasing content when you are done using it.As an example, members of our team will often go the handle route in order to avoid calling Instantiate/Release directly on the AssetReference.Q: What are the disadvantages of many small bundles?
    A: This documentation lists several disadvantages of too many bundles.Q: When an asset in a bundle is needed, what overhead do the other assets in the same bundle have? If it’s a remote bundle it must be downloaded, but is there really no memory overhead from unused assets in the bundle?
    A: Correct, a remote bundle will be fully downloaded before you can use it.Unloaded assets in a loaded asset bundle have minimal overhead at runtime. Whenever you load assets from a bundle, you need to load the bundle’s metadata. Part of this metadata includes a table of contents that lists all the assets in the bundle. More assets in a bundle equates to larger metadata.You can view this memory overhead by taking a capture with the Unity Memory Profiler. In the “All Of Memory” tab, there’s a list of all the “SerializedFile” objects in memory, one for each bundle. These objects are your bundles’ metadata.Learn more about this metadata in our documentation.Q: When working in an open-world setting, what bundling strategies can I use to unload individual assets without half unloading a bundle and relying on Resources.UnloadUnusedAssetsto clean it up, without the overhead of having every asset in its own bundle?
    A: The key thing to remember is that content should be bundled together if you expect to unload it at the same time. If your game world has “static” content, like trees and rocks for a certain biome that will not be moved by the player, that content should be bundled together. Any “dynamic” content, like items the player can pick up, should be bundled separately.This blog post and linked GitHub repo covers splitting bundles for an open-world game. It also features a way to deduplicate bundles to reduce the memory overhead of each bundle. Stages 4 and 5 are particularly relevant to open worlds.Q: When should I leave “AssetBundle CRC” enabled?
    A: The recommended practice is to have this enabled, excluding cached AssetBundles for Remote groups, and disabled for Local groups. The check is only meant to make sure the data wasn’t corrupted on download. There’s almost no reason to do the check for local AssetBundles.Q: When is it not worth it to use Addressables due to CPU performance concerns when loading and unloading assets?
    A: The Addressables system has a positive impact on CPU loading performance due to not needing to load all content up front.If you don’t use Addressables when loading a scene, you’d have to load all content and references. If you move the content to Addressables, you can choose when to load which content.For example, say you have an Inventory Manager in a scene that has a reference to 1,000 inventory items. If you don’t use Addressables, you’ll have to load every mesh, texture, audio clip, etc., for all these inventory items. If you wait to load this content, loading the scene will be faster.Q: Do all dependencies of an addressable asset also need to be Addressables, or is that only necessary if they are shared?
    A: Dependencies do not need to be marked addressable. Dependencies will be pulled into Addressables during the build process if necessary.As an example, if you make a player prefab an addressable, you don’t have to manually mark the player’s mesh, textures, or audio as addressable, too. When the bundle is built, all the dependencies that don’t yet exist in Addressables will be automatically included in the player prefab bundle.Q: If I forgot to release an asset and change scenes, what happens to this asset?
    A: Changing scenes does not inherently interact poorly with handles. But if you load an asset and forget to release its handle, the asset will persist in memory.Addressables has an internal reference-counting system. Handles are how we interact with this system. Loading an asset increments the reference count, and releasing decrements the reference count.Creators are responsible for keeping this reference count up to date. The asset will be in memory as long as the reference count is greater than one.Q: Related to the webinar example, suppose I’m making an open-world game. The boss is present somewhere in the open world. When the player heads to the boss, how do I use Addressables here? Do I send the command to load the sword async, via a trigger, at a certain distance from the enemy, or something else?
    A: It can be a fine line to choose when to load and unload content. You want to be sure the boss is ready when the player needs to see it, but might not want to load it too early when the player is still able to turn around and avoid the boss.The good thing is that you can iterate on when to load and unload content – you don’t have to get it perfectly optimized on the first try.To get started, we suggest loading all content for a particular “zone” when the player gets near. If this causes unnecessary memory pressure, you can add more fine-grained loading and unloading.If the sword is not loading soon enough, consider moving the loading trigger to start earlier, improving the load time of the sword assets by using Unity Profiler’s CPU module to see what is being loaded, or using Addressables synchronously to ensure the load is finished.This documentation includes more details and a code snippet for synchronous Addressables.Q: If I load an addressable when a scene starts, do I need to have a loading screen for it?
    A: Loading from Addressables is typically done in an asynchronous way, like with Addressables.LoadAssetAsync.There may be some content you don’t want to load before leaving a loading screen. You can collect these AsyncOperationHandles and wait for the necessary ones to complete before leaving.Q: What is the memory footprint of the addressables metadata at runtime?
    A: During Addressables initialization, the catalog file is loaded so that Addressables knows how to map labels and addresses to assets on disk or in remote locations. A larger catalog equates to a larger memory overhead at runtime.Catalog size can be reduced by stripping unnecessary data, like not including labels or GUIDs in groups that don’t need them, or by reducing the size of existing data. For example, by setting a group’s Internal Asset Naming Mode to GUID instead of filename or full path. You can view the runtime memory size of the catalog in Unity Memory Profiler.Q: What is the Unity Editor doing in the time it spends building Addressables?
    A: A build report log is output in the /Library folder. This log shows each step of the build process. To add additional details to the log, follow this path to select “Use Detailed Build Log”: Enabling Edit > Preferences > Scriptable Build Pipeline > Use Detailed Build Log.Check out visuals and documentation on how to view the log.Q: Does Resources.Loadalso have a duplication problem?
    A: Yes. It can be useful to think of Addressables content and Resources content as different “worlds.” If you have a texture in /Resources, one copy of that texture is included in the Resources file. If bundles in Addressables depend on that texture, each bundle includes an implicit copy of it. You end up with multiple copies of the texture on disk and potentially multiple copies in memory.To avoid this duplication, move the texture out of /Resources and add it to an Addressables group.Q: Do you get similar size on disk issues that are resolved by removing duplicate bundles when you don’t use Addressables?
    A: Yes. In the webinar and slides we show how deduplicating the two water racing scenes significantly reduced build size.Q: How can I prevent shader variant duplicates?
    A: Shaders can be deduplicated in the same process as any other asset – explicitly declare them in a group.If an asset is explicitly declared in an Addressables group that is going into your build, that asset will not be duplicated across multiple bundles.For shaders specifically, it is common practice for projects to use a “Shared shaders” group to contain shaders that you expect to need in memory for the lifespan of your app, and that are shared across many assets.Q: Do two Unity scenes sharing the same prefab duplicate build size?
    A: This depends on if the prefab the scenes depend on has been explicitly included in Addressables, and if the scenes are in the same or different bundles.See the visual explanation of how duplication occurs in the webinar slides and in this blog post under Stage 4.The key to remember is that all content going into a bundle needs to be able to access all of its dependencies. If you put a scene into a bundle, all of its dependencies need to either be:Explicitly included somewhere in AddressablesImplicitly included in the same bundleQ: Is it possible to compare duplicates in given groups to prevent having all the game assets packed together into an isolated group?
    A: Yes. You can run the built-in deduplication rule and then sort the assets in the Addressables Groups window into better groupings.Or, a more scalable approach is to write your own Addressables AnalyzeRules, which will appear in the Analyze window. The built-in rules are delivered as C# in the Addressables package and can serve as a baseline.For example, you may want to find every duplicate across all of your groups that start with “Character-”. Any implicit duplicates can be placed in a “Shared-Character” group.Q: Are you going to cover remote builds and local paths?
    A: We did not cover remote and local paths, which are called “Addressables Profiles” in the webinar. However, we do describe what Addressables Profiles are and how to use them in this documentation.Q: How does Addressables work with Cloud Content Delivery?
    A: CCD integration is discussed in this documentation.Q: Can you please give pointers on best practices to implement low- and high-resolution Addressables variations?
    A: You can find an example in the Addressables Sample on GitHub.Q: What if bundle content is encrypted? Does the UnityDataTool also decrypt the content?
    A: No. The data will need to be decrypted before UnityDataTool can analyze the content.Q: Is it a supported use case to build bundles from one Unity project and load the bundles at runtime from an app built from a different project?
    A: Yes. This is covered by using multiple catalogs at the same time.Q: Are there drawbacks to using InstantiateAsync, or situations where it is better to use LoadAsync + manual Instantiate?
    A: It is recommended to use Addressables.LoadAssetAsyncand call Object.Instantiate. Addressables.InstantiateAsynchas a larger performance cost.Q: I have a lot of ScriptableObjects with at least 1–2 sprites referenced as variables. If I want to change the sprites to Addressables, do I have to change the references to Addressables one by one, or is there any trick to do this?
    A: An Editor script is probably the way to go to convert these references.You can add the AssetReference fields to your ScriptableObject. Then, you can write an Editor script that iterates through your ScriptableObjects, looks up the Sprite asset in Addressables to find the associated AddressableAssetEntry, and stores the address or creates an AssetReference to be stored on the ScriptableObject.Lastly, you can remove the direct Sprite references and swap any related code to use the AssetReference.Q: Can I use addressables for WebGL games? If yes, are there any specific things to look for?
    A: Yes, and yes. Two things to note: First, WebGL does not support threading, so don’t use Tasks. Second, caching works differently on WebGL – we’ve seen issues with caching remote AssetBundles before.Q: If I use Shader.Find, is this coming from the build or Addressables?
    A: These are coming from the build of the Unity Player, not Addressables. Shader.Finddoes not return results from AssetBundles.Q: How can I organize the Addressables Groups window when I have many similarly-named groups?
    A: For organizing the Addressables Groups UI, you can enable Group Hierarchy with Dashes. This will group similarly-named groups together. For example, “Character-person” and “Character-person2” will appear in the UI under the “Character” grouping.This does not affect how bundles are created. This is only a UI organizational change.Share your feedback with us in the Addressables forum. Be sure to watch for new technical blogs from other Unity developers as part of the ongoing Tech from the Trenches series.
    #extended #qampampa #optimizing #memory #build
    Extended Q&A: Optimizing memory and build size with Addressables
    In February, as part of my role as a senior software development consultant for Unity Accelerate Solutions, I led a technical webinar about the Addressables Asset System. During the live session, I demonstrated various profiling tools that you can use to optimize a project’s runtime memory and build size. The webinar ended with a Q&A, and our team received more questions than we had time to answer.The following is an extension of that closing Q&A, so we can answer more of your questions.Q: Is the Addressables system needed for light games – like casual, arcade, or puzzle games – if I don’t have memory issues? A: Maybe not, but it’s good to keep in mind that the Addressables system doesn’t only improve memory performance. Having the ability to choose when you load content can improve loading times. Building content in Addressables enables you to have iterative builds that don’t take as long. For example, if you make a small script change, you may not have to rebuild all of your bundles.Q: Are loaded assets released when the scene switches? A: Potentially. Loaded assets from Addressables that are ready to be released because they have a ref count of zero might be unloaded from memory during a scene transition. When transitioning from scenes non-additively, call Resources.UnloadUnusedAssets. This is expensive on the CPU, but allows you to partially unload AssetBundles.Q: Do object pooling and Addressables work well together? A: Yes. You can load your object once from Addressables and then instantiate multiple copies of it to create your pool. When you are done with the pool, destroy all the objects and release the AsyncOperationHandle that was used to load the asset.Q: Are groups and bundles loaded into memory all at once? A: Addressables groups are an Editor-only concept. At runtime, you only deal with bundles. Bundles are loaded into memory only when they are needed and only the desired content is loaded.Example: You have one bundle with 10 characters in it. You ask Addressables to load three characters. The bundle’s metadata and the three characters will be loaded.Q: If I want to release an asset, do I need to keep the AsyncOperationHandle or the AssetReference? A: We recommend keeping the handle and using it, since you’re responsible for releasing content when you are done using it.As an example, members of our team will often go the handle route in order to avoid calling Instantiate/Release directly on the AssetReference.Q: What are the disadvantages of many small bundles? A: This documentation lists several disadvantages of too many bundles.Q: When an asset in a bundle is needed, what overhead do the other assets in the same bundle have? If it’s a remote bundle it must be downloaded, but is there really no memory overhead from unused assets in the bundle? A: Correct, a remote bundle will be fully downloaded before you can use it.Unloaded assets in a loaded asset bundle have minimal overhead at runtime. Whenever you load assets from a bundle, you need to load the bundle’s metadata. Part of this metadata includes a table of contents that lists all the assets in the bundle. More assets in a bundle equates to larger metadata.You can view this memory overhead by taking a capture with the Unity Memory Profiler. In the “All Of Memory” tab, there’s a list of all the “SerializedFile” objects in memory, one for each bundle. These objects are your bundles’ metadata.Learn more about this metadata in our documentation.Q: When working in an open-world setting, what bundling strategies can I use to unload individual assets without half unloading a bundle and relying on Resources.UnloadUnusedAssetsto clean it up, without the overhead of having every asset in its own bundle? A: The key thing to remember is that content should be bundled together if you expect to unload it at the same time. If your game world has “static” content, like trees and rocks for a certain biome that will not be moved by the player, that content should be bundled together. Any “dynamic” content, like items the player can pick up, should be bundled separately.This blog post and linked GitHub repo covers splitting bundles for an open-world game. It also features a way to deduplicate bundles to reduce the memory overhead of each bundle. Stages 4 and 5 are particularly relevant to open worlds.Q: When should I leave “AssetBundle CRC” enabled? A: The recommended practice is to have this enabled, excluding cached AssetBundles for Remote groups, and disabled for Local groups. The check is only meant to make sure the data wasn’t corrupted on download. There’s almost no reason to do the check for local AssetBundles.Q: When is it not worth it to use Addressables due to CPU performance concerns when loading and unloading assets? A: The Addressables system has a positive impact on CPU loading performance due to not needing to load all content up front.If you don’t use Addressables when loading a scene, you’d have to load all content and references. If you move the content to Addressables, you can choose when to load which content.For example, say you have an Inventory Manager in a scene that has a reference to 1,000 inventory items. If you don’t use Addressables, you’ll have to load every mesh, texture, audio clip, etc., for all these inventory items. If you wait to load this content, loading the scene will be faster.Q: Do all dependencies of an addressable asset also need to be Addressables, or is that only necessary if they are shared? A: Dependencies do not need to be marked addressable. Dependencies will be pulled into Addressables during the build process if necessary.As an example, if you make a player prefab an addressable, you don’t have to manually mark the player’s mesh, textures, or audio as addressable, too. When the bundle is built, all the dependencies that don’t yet exist in Addressables will be automatically included in the player prefab bundle.Q: If I forgot to release an asset and change scenes, what happens to this asset? A: Changing scenes does not inherently interact poorly with handles. But if you load an asset and forget to release its handle, the asset will persist in memory.Addressables has an internal reference-counting system. Handles are how we interact with this system. Loading an asset increments the reference count, and releasing decrements the reference count.Creators are responsible for keeping this reference count up to date. The asset will be in memory as long as the reference count is greater than one.Q: Related to the webinar example, suppose I’m making an open-world game. The boss is present somewhere in the open world. When the player heads to the boss, how do I use Addressables here? Do I send the command to load the sword async, via a trigger, at a certain distance from the enemy, or something else? A: It can be a fine line to choose when to load and unload content. You want to be sure the boss is ready when the player needs to see it, but might not want to load it too early when the player is still able to turn around and avoid the boss.The good thing is that you can iterate on when to load and unload content – you don’t have to get it perfectly optimized on the first try.To get started, we suggest loading all content for a particular “zone” when the player gets near. If this causes unnecessary memory pressure, you can add more fine-grained loading and unloading.If the sword is not loading soon enough, consider moving the loading trigger to start earlier, improving the load time of the sword assets by using Unity Profiler’s CPU module to see what is being loaded, or using Addressables synchronously to ensure the load is finished.This documentation includes more details and a code snippet for synchronous Addressables.Q: If I load an addressable when a scene starts, do I need to have a loading screen for it? A: Loading from Addressables is typically done in an asynchronous way, like with Addressables.LoadAssetAsync.There may be some content you don’t want to load before leaving a loading screen. You can collect these AsyncOperationHandles and wait for the necessary ones to complete before leaving.Q: What is the memory footprint of the addressables metadata at runtime? A: During Addressables initialization, the catalog file is loaded so that Addressables knows how to map labels and addresses to assets on disk or in remote locations. A larger catalog equates to a larger memory overhead at runtime.Catalog size can be reduced by stripping unnecessary data, like not including labels or GUIDs in groups that don’t need them, or by reducing the size of existing data. For example, by setting a group’s Internal Asset Naming Mode to GUID instead of filename or full path. You can view the runtime memory size of the catalog in Unity Memory Profiler.Q: What is the Unity Editor doing in the time it spends building Addressables? A: A build report log is output in the /Library folder. This log shows each step of the build process. To add additional details to the log, follow this path to select “Use Detailed Build Log”: Enabling Edit > Preferences > Scriptable Build Pipeline > Use Detailed Build Log.Check out visuals and documentation on how to view the log.Q: Does Resources.Loadalso have a duplication problem? A: Yes. It can be useful to think of Addressables content and Resources content as different “worlds.” If you have a texture in /Resources, one copy of that texture is included in the Resources file. If bundles in Addressables depend on that texture, each bundle includes an implicit copy of it. You end up with multiple copies of the texture on disk and potentially multiple copies in memory.To avoid this duplication, move the texture out of /Resources and add it to an Addressables group.Q: Do you get similar size on disk issues that are resolved by removing duplicate bundles when you don’t use Addressables? A: Yes. In the webinar and slides we show how deduplicating the two water racing scenes significantly reduced build size.Q: How can I prevent shader variant duplicates? A: Shaders can be deduplicated in the same process as any other asset – explicitly declare them in a group.If an asset is explicitly declared in an Addressables group that is going into your build, that asset will not be duplicated across multiple bundles.For shaders specifically, it is common practice for projects to use a “Shared shaders” group to contain shaders that you expect to need in memory for the lifespan of your app, and that are shared across many assets.Q: Do two Unity scenes sharing the same prefab duplicate build size? A: This depends on if the prefab the scenes depend on has been explicitly included in Addressables, and if the scenes are in the same or different bundles.See the visual explanation of how duplication occurs in the webinar slides and in this blog post under Stage 4.The key to remember is that all content going into a bundle needs to be able to access all of its dependencies. If you put a scene into a bundle, all of its dependencies need to either be:Explicitly included somewhere in AddressablesImplicitly included in the same bundleQ: Is it possible to compare duplicates in given groups to prevent having all the game assets packed together into an isolated group? A: Yes. You can run the built-in deduplication rule and then sort the assets in the Addressables Groups window into better groupings.Or, a more scalable approach is to write your own Addressables AnalyzeRules, which will appear in the Analyze window. The built-in rules are delivered as C# in the Addressables package and can serve as a baseline.For example, you may want to find every duplicate across all of your groups that start with “Character-”. Any implicit duplicates can be placed in a “Shared-Character” group.Q: Are you going to cover remote builds and local paths? A: We did not cover remote and local paths, which are called “Addressables Profiles” in the webinar. However, we do describe what Addressables Profiles are and how to use them in this documentation.Q: How does Addressables work with Cloud Content Delivery? A: CCD integration is discussed in this documentation.Q: Can you please give pointers on best practices to implement low- and high-resolution Addressables variations? A: You can find an example in the Addressables Sample on GitHub.Q: What if bundle content is encrypted? Does the UnityDataTool also decrypt the content? A: No. The data will need to be decrypted before UnityDataTool can analyze the content.Q: Is it a supported use case to build bundles from one Unity project and load the bundles at runtime from an app built from a different project? A: Yes. This is covered by using multiple catalogs at the same time.Q: Are there drawbacks to using InstantiateAsync, or situations where it is better to use LoadAsync + manual Instantiate? A: It is recommended to use Addressables.LoadAssetAsyncand call Object.Instantiate. Addressables.InstantiateAsynchas a larger performance cost.Q: I have a lot of ScriptableObjects with at least 1–2 sprites referenced as variables. If I want to change the sprites to Addressables, do I have to change the references to Addressables one by one, or is there any trick to do this? A: An Editor script is probably the way to go to convert these references.You can add the AssetReference fields to your ScriptableObject. Then, you can write an Editor script that iterates through your ScriptableObjects, looks up the Sprite asset in Addressables to find the associated AddressableAssetEntry, and stores the address or creates an AssetReference to be stored on the ScriptableObject.Lastly, you can remove the direct Sprite references and swap any related code to use the AssetReference.Q: Can I use addressables for WebGL games? If yes, are there any specific things to look for? A: Yes, and yes. Two things to note: First, WebGL does not support threading, so don’t use Tasks. Second, caching works differently on WebGL – we’ve seen issues with caching remote AssetBundles before.Q: If I use Shader.Find, is this coming from the build or Addressables? A: These are coming from the build of the Unity Player, not Addressables. Shader.Finddoes not return results from AssetBundles.Q: How can I organize the Addressables Groups window when I have many similarly-named groups? A: For organizing the Addressables Groups UI, you can enable Group Hierarchy with Dashes. This will group similarly-named groups together. For example, “Character-person” and “Character-person2” will appear in the UI under the “Character” grouping.This does not affect how bundles are created. This is only a UI organizational change.Share your feedback with us in the Addressables forum. Be sure to watch for new technical blogs from other Unity developers as part of the ongoing Tech from the Trenches series. #extended #qampampa #optimizing #memory #build
    UNITY.COM
    Extended Q&A: Optimizing memory and build size with Addressables
    In February, as part of my role as a senior software development consultant for Unity Accelerate Solutions, I led a technical webinar about the Addressables Asset System. During the live session, I demonstrated various profiling tools that you can use to optimize a project’s runtime memory and build size. The webinar ended with a Q&A, and our team received more questions than we had time to answer.The following is an extension of that closing Q&A, so we can answer more of your questions.Q: Is the Addressables system needed for light games – like casual, arcade, or puzzle games – if I don’t have memory issues? A: Maybe not, but it’s good to keep in mind that the Addressables system doesn’t only improve memory performance. Having the ability to choose when you load content can improve loading times. Building content in Addressables enables you to have iterative builds that don’t take as long. For example, if you make a small script change, you may not have to rebuild all of your bundles.Q: Are loaded assets released when the scene switches? A: Potentially. Loaded assets from Addressables that are ready to be released because they have a ref count of zero might be unloaded from memory during a scene transition. When transitioning from scenes non-additively, call Resources.UnloadUnusedAssets(). This is expensive on the CPU, but allows you to partially unload AssetBundles.Q: Do object pooling and Addressables work well together? A: Yes. You can load your object once from Addressables and then instantiate multiple copies of it to create your pool. When you are done with the pool, destroy all the objects and release the AsyncOperationHandle that was used to load the asset.Q: Are groups and bundles loaded into memory all at once? A: Addressables groups are an Editor-only concept. At runtime, you only deal with bundles. Bundles are loaded into memory only when they are needed and only the desired content is loaded.Example: You have one bundle with 10 characters in it. You ask Addressables to load three characters. The bundle’s metadata and the three characters will be loaded.Q: If I want to release an asset, do I need to keep the AsyncOperationHandle or the AssetReference? A: We recommend keeping the handle and using it, since you’re responsible for releasing content when you are done using it.As an example, members of our team will often go the handle route in order to avoid calling Instantiate/Release directly on the AssetReference.Q: What are the disadvantages of many small bundles? A: This documentation lists several disadvantages of too many bundles.Q: When an asset in a bundle is needed, what overhead do the other assets in the same bundle have? If it’s a remote bundle it must be downloaded, but is there really no memory overhead from unused assets in the bundle? A: Correct, a remote bundle will be fully downloaded before you can use it.Unloaded assets in a loaded asset bundle have minimal overhead at runtime. Whenever you load assets from a bundle, you need to load the bundle’s metadata. Part of this metadata includes a table of contents that lists all the assets in the bundle. More assets in a bundle equates to larger metadata.You can view this memory overhead by taking a capture with the Unity Memory Profiler. In the “All Of Memory” tab, there’s a list of all the “SerializedFile” objects in memory, one for each bundle. These objects are your bundles’ metadata.Learn more about this metadata in our documentation.Q: When working in an open-world setting, what bundling strategies can I use to unload individual assets without half unloading a bundle and relying on Resources.UnloadUnusedAssets() to clean it up, without the overhead of having every asset in its own bundle? A: The key thing to remember is that content should be bundled together if you expect to unload it at the same time. If your game world has “static” content, like trees and rocks for a certain biome that will not be moved by the player, that content should be bundled together. Any “dynamic” content, like items the player can pick up, should be bundled separately.This blog post and linked GitHub repo covers splitting bundles for an open-world game. It also features a way to deduplicate bundles to reduce the memory overhead of each bundle. Stages 4 and 5 are particularly relevant to open worlds.Q: When should I leave “AssetBundle CRC” enabled? A: The recommended practice is to have this enabled, excluding cached AssetBundles for Remote groups, and disabled for Local groups. The check is only meant to make sure the data wasn’t corrupted on download. There’s almost no reason to do the check for local AssetBundles.Q: When is it not worth it to use Addressables due to CPU performance concerns when loading and unloading assets? A: The Addressables system has a positive impact on CPU loading performance due to not needing to load all content up front.If you don’t use Addressables when loading a scene, you’d have to load all content and references. If you move the content to Addressables, you can choose when to load which content.For example, say you have an Inventory Manager in a scene that has a reference to 1,000 inventory items. If you don’t use Addressables, you’ll have to load every mesh, texture, audio clip, etc., for all these inventory items. If you wait to load this content, loading the scene will be faster.Q: Do all dependencies of an addressable asset also need to be Addressables, or is that only necessary if they are shared? A: Dependencies do not need to be marked addressable. Dependencies will be pulled into Addressables during the build process if necessary.As an example, if you make a player prefab an addressable, you don’t have to manually mark the player’s mesh, textures, or audio as addressable, too. When the bundle is built, all the dependencies that don’t yet exist in Addressables will be automatically included in the player prefab bundle.Q: If I forgot to release an asset and change scenes, what happens to this asset? A: Changing scenes does not inherently interact poorly with handles. But if you load an asset and forget to release its handle, the asset will persist in memory.Addressables has an internal reference-counting system. Handles are how we interact with this system. Loading an asset increments the reference count, and releasing decrements the reference count.Creators are responsible for keeping this reference count up to date. The asset will be in memory as long as the reference count is greater than one.Q: Related to the webinar example, suppose I’m making an open-world game. The boss is present somewhere in the open world. When the player heads to the boss, how do I use Addressables here? Do I send the command to load the sword async, via a trigger, at a certain distance from the enemy, or something else? A: It can be a fine line to choose when to load and unload content. You want to be sure the boss is ready when the player needs to see it, but might not want to load it too early when the player is still able to turn around and avoid the boss.The good thing is that you can iterate on when to load and unload content – you don’t have to get it perfectly optimized on the first try.To get started, we suggest loading all content for a particular “zone” when the player gets near (e.g., the player approaches a dungeon entrance which causes everything inside the dungeon to load). If this causes unnecessary memory pressure, you can add more fine-grained loading and unloading.If the sword is not loading soon enough, consider moving the loading trigger to start earlier, improving the load time of the sword assets by using Unity Profiler’s CPU module to see what is being loaded, or using Addressables synchronously to ensure the load is finished.This documentation includes more details and a code snippet for synchronous Addressables.Q: If I load an addressable when a scene starts, do I need to have a loading screen for it? A: Loading from Addressables is typically done in an asynchronous way, like with Addressables.LoadAssetAsync().There may be some content you don’t want to load before leaving a loading screen. You can collect these AsyncOperationHandles and wait for the necessary ones to complete before leaving.Q: What is the memory footprint of the addressables metadata at runtime (before loading any of its data)? A: During Addressables initialization, the catalog file is loaded so that Addressables knows how to map labels and addresses to assets on disk or in remote locations. A larger catalog equates to a larger memory overhead at runtime.Catalog size can be reduced by stripping unnecessary data, like not including labels or GUIDs in groups that don’t need them, or by reducing the size of existing data. For example, by setting a group’s Internal Asset Naming Mode to GUID instead of filename or full path (which can be longer). You can view the runtime memory size of the catalog in Unity Memory Profiler.Q: What is the Unity Editor doing in the time it spends building Addressables? A: A build report log is output in the /Library folder. This log shows each step of the build process. To add additional details to the log, follow this path to select “Use Detailed Build Log”: Enabling Edit > Preferences > Scriptable Build Pipeline > Use Detailed Build Log.Check out visuals and documentation on how to view the log.Q: Does Resources.Load() also have a duplication problem? A: Yes. It can be useful to think of Addressables content and Resources content as different “worlds.” If you have a texture in /Resources, one copy of that texture is included in the Resources file. If bundles in Addressables depend on that texture, each bundle includes an implicit copy of it. You end up with multiple copies of the texture on disk and potentially multiple copies in memory.To avoid this duplication, move the texture out of /Resources and add it to an Addressables group.Q: Do you get similar size on disk issues that are resolved by removing duplicate bundles when you don’t use Addressables? A: Yes. In the webinar and slides we show how deduplicating the two water racing scenes significantly reduced build size.Q: How can I prevent shader variant duplicates? A: Shaders can be deduplicated in the same process as any other asset – explicitly declare them in a group.If an asset is explicitly declared in an Addressables group that is going into your build, that asset will not be duplicated across multiple bundles.For shaders specifically, it is common practice for projects to use a “Shared shaders” group to contain shaders that you expect to need in memory for the lifespan of your app, and that are shared across many assets.Q: Do two Unity scenes sharing the same prefab duplicate build size? A: This depends on if the prefab the scenes depend on has been explicitly included in Addressables, and if the scenes are in the same or different bundles.See the visual explanation of how duplication occurs in the webinar slides and in this blog post under Stage 4.The key to remember is that all content going into a bundle needs to be able to access all of its dependencies. If you put a scene into a bundle, all of its dependencies need to either be:Explicitly included somewhere in AddressablesImplicitly included in the same bundleQ: Is it possible to compare duplicates in given groups to prevent having all the game assets packed together into an isolated group? A: Yes. You can run the built-in deduplication rule and then sort the assets in the Addressables Groups window into better groupings.Or, a more scalable approach is to write your own Addressables AnalyzeRules, which will appear in the Analyze window. The built-in rules are delivered as C# in the Addressables package and can serve as a baseline.For example, you may want to find every duplicate across all of your groups that start with “Character-”. Any implicit duplicates can be placed in a “Shared-Character” group.Q: Are you going to cover remote builds and local paths? A: We did not cover remote and local paths, which are called “Addressables Profiles” in the webinar. However, we do describe what Addressables Profiles are and how to use them in this documentation.Q: How does Addressables work with Cloud Content Delivery (CCD)? A: CCD integration is discussed in this documentation.Q: Can you please give pointers on best practices to implement low- and high-resolution Addressables variations? A: You can find an example in the Addressables Sample on GitHub.Q: What if bundle content is encrypted? Does the UnityDataTool also decrypt the content? A: No. The data will need to be decrypted before UnityDataTool can analyze the content.Q: Is it a supported use case to build bundles from one Unity project and load the bundles at runtime from an app built from a different project? A: Yes. This is covered by using multiple catalogs at the same time.Q: Are there drawbacks to using InstantiateAsync, or situations where it is better to use LoadAsync + manual Instantiate? A: It is recommended to use Addressables.LoadAssetAsync() and call Object.Instantiate(). Addressables.InstantiateAsync() has a larger performance cost.Q: I have a lot of ScriptableObjects with at least 1–2 sprites referenced as variables. If I want to change the sprites to Addressables, do I have to change the references to Addressables one by one, or is there any trick to do this? A: An Editor script is probably the way to go to convert these references.You can add the AssetReference fields to your ScriptableObject (and temporarily keep the Sprite fields). Then, you can write an Editor script that iterates through your ScriptableObjects, looks up the Sprite asset in Addressables to find the associated AddressableAssetEntry, and stores the address or creates an AssetReference to be stored on the ScriptableObject.Lastly, you can remove the direct Sprite references and swap any related code to use the AssetReference.Q: Can I use addressables for WebGL games? If yes, are there any specific things to look for? A: Yes, and yes. Two things to note: First, WebGL does not support threading, so don’t use Tasks. Second, caching works differently on WebGL – we’ve seen issues with caching remote AssetBundles before.Q: If I use Shader.Find(“ShaderName”), is this coming from the build or Addressables? A: These are coming from the build of the Unity Player, not Addressables. Shader.Find() does not return results from AssetBundles.Q: How can I organize the Addressables Groups window when I have many similarly-named groups? A: For organizing the Addressables Groups UI, you can enable Group Hierarchy with Dashes. This will group similarly-named groups together. For example, “Character-person” and “Character-person2” will appear in the UI under the “Character” grouping.This does not affect how bundles are created. This is only a UI organizational change.Share your feedback with us in the Addressables forum. Be sure to watch for new technical blogs from other Unity developers as part of the ongoing Tech from the Trenches series.
    0 Yorumlar 0 hisse senetleri