• 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 Kommentare 0 Anteile
  • 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 Kommentare 0 Anteile
  • Level up your code with game programming patterns

    If you have experience with object-oriented programming languages, then you’ve likely heard of the SOLID principles, MVP, singleton, factory, and observer patterns. Our new e-book highlights best practices for using these principles and patterns to create scalable game code architecture in your Unity project.For every software design issue you encounter, a thousand developers have been there before. Though you can’t always ask them directly for advice, you can learn from their decisions through design patterns.By implementing common, game programming design patterns in your Unity project, you can efficiently build and maintain a clean, organized, and readable codebase, which in turn, creates a solid foundation for scaling your game, development team, and business.In our community, we often hear that it can be intimidating to learn how to incorporate design patterns and principles, such as SOLID and KISS, into daily development. That’s why our free e-book, Level up your code with game programming patterns, explains well-known design patterns and shares practical examples for using them in your Unity project.Written by internal and external Unity experts, the e-book is a resource that can help expand your developer’s toolbox and accelerate your project’s success. Read on for a preview of what the guide entails.Design patterns are general solutions to common problems found in software engineering. These aren’t finished solutions you can copy and paste into your code, but extra tools that can help you build larger, scalable applications when used correctly.By integrating patterns consistently into your project, you can improve code readability and make your codebase cleaner. Design patterns not only reduce refactoring and the time spent testing, they speed up onboarding and development processes.However, every design pattern comes with tradeoffs, whether that means additional structures to maintain or more setup at the beginning. You’ll need to do a cost-benefit assessment to determine if the advantage justifies the extra work required. Of course, this assessment will vary based on your project.KISS stands for “keep it simple, stupid.” The aim of this principle is to avoid unnecessary complexity in a system, as simplicity helps drive greater levels of user acceptance and interaction.Note that “simple” does not equate to “easy.” Making something simple means making it focused. While you can create the same functionality without the patterns, something fast and easy doesn’t necessarily result in something simple.If you’re unsure whether a pattern applies to your particular issue, you might hold off until it feels like a more natural fit. Don’t use a pattern because it’s new or novel to you. Use it when you need it.It’s in this spirit that the e-book was created. Keep the guide handy as a source of inspiration for new ways of organizing your code – not as a strict set of rules for you to follow.Now, let’s turn to some of the key software design principles.SOLID is a mnemonic acronym for five core fundamentals of software design. You can think of them as five basic rules to keep in mind while coding, to ensure that object-oriented designs remain flexible and maintainable.The SOLID principles were first introduced by Robert C. Martin in the paper, Design Principles and Design Patterns. First published in 2000, the principles described are still applicable today, and to C# scripting in Unity:Single responsibility states that each module, class, or function is responsible for one thing and encapsulates only that part of the logic.Open-closed states that classes must be open for extension but closed for modification; that means structuring your classes to create new behavior without modifying the original code.Liskov substitution states that derived classes must be substitutable for their base class when using inheritance.Interface segregation states that no client should be forced to depend on methods it does not use. Clients should only implement what they need.Dependency inversion states that high-level modules should not import anything directly from low-level modules. Both should depend on abstractions.In the e-book, we provide illustrated examples of each principle with clear explanations for using them in Unity. In some cases, adhering to SOLID can result in additional work up front. You may need to refactor some of your functionality into abstractions or interfaces, but there is often a payoff in long-term savings.The principles have dominated software design for nearly two decades at the enterprise level because they’re so well-suited to large applications that scale. If you’re unsure about how to use them, refer back to the KISS principle. Keep it simple, and don’t try to force the principles into your scripts just for the sake of doing so. Let them organically work themselves into place through necessity.If you’re interested in learning more, check out the SOLID presentation from Unite Austin 2017 by Dan Sagmiller of Productive Edge.What’s the difference between a design principle and a design pattern? One way to answer that question is to consider SOLID as a framework for, or a foundational approach to, writing object-oriented code. While design patterns are solutions or tools you can implement to avoid everyday software problems, remember that they’re not off-the-shelf recipes – or for that matter, algorithms with specific steps for achieving specific results.A design pattern can be thought of as a blueprint. It’s a general plan that leaves the actual construction up to you. For instance, two programs can follow the same pattern but involve very different code.When developers encounter the same problem in the wild, many of them will inevitably come up with similar solutions. Once a solution is repeated enough times, someone might “discover” a pattern and formally give it a name.Many of today’s software design patterns stem from the seminal work, Design Patterns: Elements of Reusable Object-Oriented Software by Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides. This book unpacks 23 such patterns identified in a variety of day-to-day applications.The original authors are often referred to as the “Gang of Four”,and you’ll also hear the original patterns dubbed the GoF patterns. While the examples cited are mostly in C++, you can apply their ideas to any object-oriented language, such as C#.Since the Gang of Four originally published Design Patterns in 1994, developers have since established dozens more object-oriented patterns in a variety of fields, including game development.While you can work as a game programmer without studying design patterns, learning them will help you become a better developer. After all, design patterns are labeled as such because they’re common solutions to well-known problems.Software engineers rediscover them all the time in the normal course of development. You may have already implemented some of these patterns unwittingly.Train yourself to look for them. Doing this can help you:Learn object-oriented programming: Design patterns aren’t secrets buried in an esoteric StackOverflow post. They are common ways to overcome everyday hurdles in development. They can inform you of how many other developers have approached the same issue – remember, even if you’re not using patterns, someone else is.Talk to other developers: Patterns can serve as a shorthand when trying to communicate as a team. Mention the “command pattern” or “object pool” and experienced Unity developers will know what you’re trying to implement.Explore new frameworks:When you import a built-in package or something from the Asset Store, inevitably you’ll stumble onto one or more patterns discussed here. Recognizing design patterns will help you understand how a new framework operates, as well as the thought process involved in its creation.As indicated earlier, not all design patterns apply to every game application. Don’t go looking for them with Maslow’s hammer; otherwise, you might only find nails.Like any other tool, a design pattern’s usefulness depends on context. Each one provides a benefit in certain situations and also comes with its share of drawbacks. Every decision in software development comes with compromises.Are you generating a lot of GameObjects on the fly? Does it impact your performance? Can restructuring your code fix that? Be aware of these design patterns, and when the time is right, pull them from your gamedev bag of tricks to solve the problem at hand.In addition to the Gang of Four’s Design Patterns, Game Programming Patterns by Robert Nystrom is another standout resource, currently available for free as a web-based edition. The author details a variety of software patterns in a no-nonsense manner.In our new e-book, you can dive into the sections that explain common design patterns, such as factory, object pool, singleton, command, state, and observer patterns, plus the Model View Presenter, among others. Each section explains the pattern along with its pros and cons, and provides an example of how to implement it in Unity so you can optimize its usage in your project.Unity already implements several established gamedev patterns, saving you the trouble of writing them yourself. These include:Game loop: At the core of all games is an infinite loop that must function independently of clock speed, since the hardware that powers a game application can vary greatly. To account for computers of different speeds, game developers often need to use a fixed timestepand a variable timestep where the engine measures how much time has passed since the previous frame.

    Unity takes care of this, so you don’t have to implement it yourself. You only need to manage gameplay using MonoBehaviour methods like Update, LateUpdate, and FixedUpdate.
    Update: In your game application, you’ll often update each object’s behavior one frame at a time. While you can manually recreate this in Unity, the MonoBehaviour class does this automatically. Use the appropriate Update, LateUpdate, or FixedUpdate methods to modify your GameObjects and components to one tick of the game clock.Prototype: Often you need to copy objects without affecting the original. This creational pattern solves the problem of duplicating and cloning an object to make other objects similar to itself. This way you avoid defining a separate class to spawn every type of object in your game.

    Unity’s Prefab system implements a form of prototyping for GameObjects. This allows you to duplicate a template object complete with its components. Override specific properties to create Prefab Variants or nest Prefabs inside other Prefabs to create hierarchies. Use a special Prefab editing mode to edit Prefabs in isolation or in context.
    Component:Most people working in Unity know this pattern. Instead of creating large classes with multiple responsibilities, build smaller components that each do one thing.

    If you use composition to pick and choose components, you can combine them for complex behavior. Add Rigidbody and Collider components for physics, or a MeshFilter and MeshRenderer for 3D geometry. Each GameObject is only as rich and unique as its collection of components.Both the e-book and a sample project on the use of design patterns are available now to download for free. Review the examples and decide which design pattern best suits your project. As you gain experience with them, you’ll recognize how and when they can enhance your development process. As always, we encourage you to visit the forum thread and let us know what you think of the e-book and sample.
    #level #your #code #with #game
    Level up your code with game programming patterns
    If you have experience with object-oriented programming languages, then you’ve likely heard of the SOLID principles, MVP, singleton, factory, and observer patterns. Our new e-book highlights best practices for using these principles and patterns to create scalable game code architecture in your Unity project.For every software design issue you encounter, a thousand developers have been there before. Though you can’t always ask them directly for advice, you can learn from their decisions through design patterns.By implementing common, game programming design patterns in your Unity project, you can efficiently build and maintain a clean, organized, and readable codebase, which in turn, creates a solid foundation for scaling your game, development team, and business.In our community, we often hear that it can be intimidating to learn how to incorporate design patterns and principles, such as SOLID and KISS, into daily development. That’s why our free e-book, Level up your code with game programming patterns, explains well-known design patterns and shares practical examples for using them in your Unity project.Written by internal and external Unity experts, the e-book is a resource that can help expand your developer’s toolbox and accelerate your project’s success. Read on for a preview of what the guide entails.Design patterns are general solutions to common problems found in software engineering. These aren’t finished solutions you can copy and paste into your code, but extra tools that can help you build larger, scalable applications when used correctly.By integrating patterns consistently into your project, you can improve code readability and make your codebase cleaner. Design patterns not only reduce refactoring and the time spent testing, they speed up onboarding and development processes.However, every design pattern comes with tradeoffs, whether that means additional structures to maintain or more setup at the beginning. You’ll need to do a cost-benefit assessment to determine if the advantage justifies the extra work required. Of course, this assessment will vary based on your project.KISS stands for “keep it simple, stupid.” The aim of this principle is to avoid unnecessary complexity in a system, as simplicity helps drive greater levels of user acceptance and interaction.Note that “simple” does not equate to “easy.” Making something simple means making it focused. While you can create the same functionality without the patterns, something fast and easy doesn’t necessarily result in something simple.If you’re unsure whether a pattern applies to your particular issue, you might hold off until it feels like a more natural fit. Don’t use a pattern because it’s new or novel to you. Use it when you need it.It’s in this spirit that the e-book was created. Keep the guide handy as a source of inspiration for new ways of organizing your code – not as a strict set of rules for you to follow.Now, let’s turn to some of the key software design principles.SOLID is a mnemonic acronym for five core fundamentals of software design. You can think of them as five basic rules to keep in mind while coding, to ensure that object-oriented designs remain flexible and maintainable.The SOLID principles were first introduced by Robert C. Martin in the paper, Design Principles and Design Patterns. First published in 2000, the principles described are still applicable today, and to C# scripting in Unity:Single responsibility states that each module, class, or function is responsible for one thing and encapsulates only that part of the logic.Open-closed states that classes must be open for extension but closed for modification; that means structuring your classes to create new behavior without modifying the original code.Liskov substitution states that derived classes must be substitutable for their base class when using inheritance.Interface segregation states that no client should be forced to depend on methods it does not use. Clients should only implement what they need.Dependency inversion states that high-level modules should not import anything directly from low-level modules. Both should depend on abstractions.In the e-book, we provide illustrated examples of each principle with clear explanations for using them in Unity. In some cases, adhering to SOLID can result in additional work up front. You may need to refactor some of your functionality into abstractions or interfaces, but there is often a payoff in long-term savings.The principles have dominated software design for nearly two decades at the enterprise level because they’re so well-suited to large applications that scale. If you’re unsure about how to use them, refer back to the KISS principle. Keep it simple, and don’t try to force the principles into your scripts just for the sake of doing so. Let them organically work themselves into place through necessity.If you’re interested in learning more, check out the SOLID presentation from Unite Austin 2017 by Dan Sagmiller of Productive Edge.What’s the difference between a design principle and a design pattern? One way to answer that question is to consider SOLID as a framework for, or a foundational approach to, writing object-oriented code. While design patterns are solutions or tools you can implement to avoid everyday software problems, remember that they’re not off-the-shelf recipes – or for that matter, algorithms with specific steps for achieving specific results.A design pattern can be thought of as a blueprint. It’s a general plan that leaves the actual construction up to you. For instance, two programs can follow the same pattern but involve very different code.When developers encounter the same problem in the wild, many of them will inevitably come up with similar solutions. Once a solution is repeated enough times, someone might “discover” a pattern and formally give it a name.Many of today’s software design patterns stem from the seminal work, Design Patterns: Elements of Reusable Object-Oriented Software by Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides. This book unpacks 23 such patterns identified in a variety of day-to-day applications.The original authors are often referred to as the “Gang of Four”,and you’ll also hear the original patterns dubbed the GoF patterns. While the examples cited are mostly in C++, you can apply their ideas to any object-oriented language, such as C#.Since the Gang of Four originally published Design Patterns in 1994, developers have since established dozens more object-oriented patterns in a variety of fields, including game development.While you can work as a game programmer without studying design patterns, learning them will help you become a better developer. After all, design patterns are labeled as such because they’re common solutions to well-known problems.Software engineers rediscover them all the time in the normal course of development. You may have already implemented some of these patterns unwittingly.Train yourself to look for them. Doing this can help you:Learn object-oriented programming: Design patterns aren’t secrets buried in an esoteric StackOverflow post. They are common ways to overcome everyday hurdles in development. They can inform you of how many other developers have approached the same issue – remember, even if you’re not using patterns, someone else is.Talk to other developers: Patterns can serve as a shorthand when trying to communicate as a team. Mention the “command pattern” or “object pool” and experienced Unity developers will know what you’re trying to implement.Explore new frameworks:When you import a built-in package or something from the Asset Store, inevitably you’ll stumble onto one or more patterns discussed here. Recognizing design patterns will help you understand how a new framework operates, as well as the thought process involved in its creation.As indicated earlier, not all design patterns apply to every game application. Don’t go looking for them with Maslow’s hammer; otherwise, you might only find nails.Like any other tool, a design pattern’s usefulness depends on context. Each one provides a benefit in certain situations and also comes with its share of drawbacks. Every decision in software development comes with compromises.Are you generating a lot of GameObjects on the fly? Does it impact your performance? Can restructuring your code fix that? Be aware of these design patterns, and when the time is right, pull them from your gamedev bag of tricks to solve the problem at hand.In addition to the Gang of Four’s Design Patterns, Game Programming Patterns by Robert Nystrom is another standout resource, currently available for free as a web-based edition. The author details a variety of software patterns in a no-nonsense manner.In our new e-book, you can dive into the sections that explain common design patterns, such as factory, object pool, singleton, command, state, and observer patterns, plus the Model View Presenter, among others. Each section explains the pattern along with its pros and cons, and provides an example of how to implement it in Unity so you can optimize its usage in your project.Unity already implements several established gamedev patterns, saving you the trouble of writing them yourself. These include:Game loop: At the core of all games is an infinite loop that must function independently of clock speed, since the hardware that powers a game application can vary greatly. To account for computers of different speeds, game developers often need to use a fixed timestepand a variable timestep where the engine measures how much time has passed since the previous frame. Unity takes care of this, so you don’t have to implement it yourself. You only need to manage gameplay using MonoBehaviour methods like Update, LateUpdate, and FixedUpdate. Update: In your game application, you’ll often update each object’s behavior one frame at a time. While you can manually recreate this in Unity, the MonoBehaviour class does this automatically. Use the appropriate Update, LateUpdate, or FixedUpdate methods to modify your GameObjects and components to one tick of the game clock.Prototype: Often you need to copy objects without affecting the original. This creational pattern solves the problem of duplicating and cloning an object to make other objects similar to itself. This way you avoid defining a separate class to spawn every type of object in your game. Unity’s Prefab system implements a form of prototyping for GameObjects. This allows you to duplicate a template object complete with its components. Override specific properties to create Prefab Variants or nest Prefabs inside other Prefabs to create hierarchies. Use a special Prefab editing mode to edit Prefabs in isolation or in context. Component:Most people working in Unity know this pattern. Instead of creating large classes with multiple responsibilities, build smaller components that each do one thing. If you use composition to pick and choose components, you can combine them for complex behavior. Add Rigidbody and Collider components for physics, or a MeshFilter and MeshRenderer for 3D geometry. Each GameObject is only as rich and unique as its collection of components.Both the e-book and a sample project on the use of design patterns are available now to download for free. Review the examples and decide which design pattern best suits your project. As you gain experience with them, you’ll recognize how and when they can enhance your development process. As always, we encourage you to visit the forum thread and let us know what you think of the e-book and sample. #level #your #code #with #game
    UNITY.COM
    Level up your code with game programming patterns
    If you have experience with object-oriented programming languages, then you’ve likely heard of the SOLID principles, MVP, singleton, factory, and observer patterns. Our new e-book highlights best practices for using these principles and patterns to create scalable game code architecture in your Unity project.For every software design issue you encounter, a thousand developers have been there before. Though you can’t always ask them directly for advice, you can learn from their decisions through design patterns.By implementing common, game programming design patterns in your Unity project, you can efficiently build and maintain a clean, organized, and readable codebase, which in turn, creates a solid foundation for scaling your game, development team, and business.In our community, we often hear that it can be intimidating to learn how to incorporate design patterns and principles, such as SOLID and KISS, into daily development. That’s why our free e-book, Level up your code with game programming patterns, explains well-known design patterns and shares practical examples for using them in your Unity project.Written by internal and external Unity experts, the e-book is a resource that can help expand your developer’s toolbox and accelerate your project’s success. Read on for a preview of what the guide entails.Design patterns are general solutions to common problems found in software engineering. These aren’t finished solutions you can copy and paste into your code, but extra tools that can help you build larger, scalable applications when used correctly.By integrating patterns consistently into your project, you can improve code readability and make your codebase cleaner. Design patterns not only reduce refactoring and the time spent testing, they speed up onboarding and development processes.However, every design pattern comes with tradeoffs, whether that means additional structures to maintain or more setup at the beginning. You’ll need to do a cost-benefit assessment to determine if the advantage justifies the extra work required. Of course, this assessment will vary based on your project.KISS stands for “keep it simple, stupid.” The aim of this principle is to avoid unnecessary complexity in a system, as simplicity helps drive greater levels of user acceptance and interaction.Note that “simple” does not equate to “easy.” Making something simple means making it focused. While you can create the same functionality without the patterns (and often more quickly), something fast and easy doesn’t necessarily result in something simple.If you’re unsure whether a pattern applies to your particular issue, you might hold off until it feels like a more natural fit. Don’t use a pattern because it’s new or novel to you. Use it when you need it.It’s in this spirit that the e-book was created. Keep the guide handy as a source of inspiration for new ways of organizing your code – not as a strict set of rules for you to follow.Now, let’s turn to some of the key software design principles.SOLID is a mnemonic acronym for five core fundamentals of software design. You can think of them as five basic rules to keep in mind while coding, to ensure that object-oriented designs remain flexible and maintainable.The SOLID principles were first introduced by Robert C. Martin in the paper, Design Principles and Design Patterns. First published in 2000, the principles described are still applicable today, and to C# scripting in Unity:Single responsibility states that each module, class, or function is responsible for one thing and encapsulates only that part of the logic.Open-closed states that classes must be open for extension but closed for modification; that means structuring your classes to create new behavior without modifying the original code.Liskov substitution states that derived classes must be substitutable for their base class when using inheritance.Interface segregation states that no client should be forced to depend on methods it does not use. Clients should only implement what they need.Dependency inversion states that high-level modules should not import anything directly from low-level modules. Both should depend on abstractions.In the e-book, we provide illustrated examples of each principle with clear explanations for using them in Unity. In some cases, adhering to SOLID can result in additional work up front. You may need to refactor some of your functionality into abstractions or interfaces, but there is often a payoff in long-term savings.The principles have dominated software design for nearly two decades at the enterprise level because they’re so well-suited to large applications that scale. If you’re unsure about how to use them, refer back to the KISS principle. Keep it simple, and don’t try to force the principles into your scripts just for the sake of doing so. Let them organically work themselves into place through necessity.If you’re interested in learning more, check out the SOLID presentation from Unite Austin 2017 by Dan Sagmiller of Productive Edge.What’s the difference between a design principle and a design pattern? One way to answer that question is to consider SOLID as a framework for, or a foundational approach to, writing object-oriented code. While design patterns are solutions or tools you can implement to avoid everyday software problems, remember that they’re not off-the-shelf recipes – or for that matter, algorithms with specific steps for achieving specific results.A design pattern can be thought of as a blueprint. It’s a general plan that leaves the actual construction up to you. For instance, two programs can follow the same pattern but involve very different code.When developers encounter the same problem in the wild, many of them will inevitably come up with similar solutions. Once a solution is repeated enough times, someone might “discover” a pattern and formally give it a name.Many of today’s software design patterns stem from the seminal work, Design Patterns: Elements of Reusable Object-Oriented Software by Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides. This book unpacks 23 such patterns identified in a variety of day-to-day applications.The original authors are often referred to as the “Gang of Four” (GoF),and you’ll also hear the original patterns dubbed the GoF patterns. While the examples cited are mostly in C++ (and Smalltalk), you can apply their ideas to any object-oriented language, such as C#.Since the Gang of Four originally published Design Patterns in 1994, developers have since established dozens more object-oriented patterns in a variety of fields, including game development.While you can work as a game programmer without studying design patterns, learning them will help you become a better developer. After all, design patterns are labeled as such because they’re common solutions to well-known problems.Software engineers rediscover them all the time in the normal course of development. You may have already implemented some of these patterns unwittingly.Train yourself to look for them. Doing this can help you:Learn object-oriented programming: Design patterns aren’t secrets buried in an esoteric StackOverflow post. They are common ways to overcome everyday hurdles in development. They can inform you of how many other developers have approached the same issue – remember, even if you’re not using patterns, someone else is.Talk to other developers: Patterns can serve as a shorthand when trying to communicate as a team. Mention the “command pattern” or “object pool” and experienced Unity developers will know what you’re trying to implement.Explore new frameworks:When you import a built-in package or something from the Asset Store, inevitably you’ll stumble onto one or more patterns discussed here. Recognizing design patterns will help you understand how a new framework operates, as well as the thought process involved in its creation.As indicated earlier, not all design patterns apply to every game application. Don’t go looking for them with Maslow’s hammer; otherwise, you might only find nails.Like any other tool, a design pattern’s usefulness depends on context. Each one provides a benefit in certain situations and also comes with its share of drawbacks. Every decision in software development comes with compromises.Are you generating a lot of GameObjects on the fly? Does it impact your performance? Can restructuring your code fix that? Be aware of these design patterns, and when the time is right, pull them from your gamedev bag of tricks to solve the problem at hand.In addition to the Gang of Four’s Design Patterns, Game Programming Patterns by Robert Nystrom is another standout resource, currently available for free as a web-based edition. The author details a variety of software patterns in a no-nonsense manner.In our new e-book, you can dive into the sections that explain common design patterns, such as factory, object pool, singleton, command, state, and observer patterns, plus the Model View Presenter (MVP), among others. Each section explains the pattern along with its pros and cons, and provides an example of how to implement it in Unity so you can optimize its usage in your project.Unity already implements several established gamedev patterns, saving you the trouble of writing them yourself. These include:Game loop: At the core of all games is an infinite loop that must function independently of clock speed, since the hardware that powers a game application can vary greatly. To account for computers of different speeds, game developers often need to use a fixed timestep (with a set frames-per-second) and a variable timestep where the engine measures how much time has passed since the previous frame. Unity takes care of this, so you don’t have to implement it yourself. You only need to manage gameplay using MonoBehaviour methods like Update, LateUpdate, and FixedUpdate. Update: In your game application, you’ll often update each object’s behavior one frame at a time. While you can manually recreate this in Unity, the MonoBehaviour class does this automatically. Use the appropriate Update, LateUpdate, or FixedUpdate methods to modify your GameObjects and components to one tick of the game clock.Prototype: Often you need to copy objects without affecting the original. This creational pattern solves the problem of duplicating and cloning an object to make other objects similar to itself. This way you avoid defining a separate class to spawn every type of object in your game. Unity’s Prefab system implements a form of prototyping for GameObjects. This allows you to duplicate a template object complete with its components. Override specific properties to create Prefab Variants or nest Prefabs inside other Prefabs to create hierarchies. Use a special Prefab editing mode to edit Prefabs in isolation or in context. Component:Most people working in Unity know this pattern. Instead of creating large classes with multiple responsibilities, build smaller components that each do one thing. If you use composition to pick and choose components, you can combine them for complex behavior. Add Rigidbody and Collider components for physics, or a MeshFilter and MeshRenderer for 3D geometry. Each GameObject is only as rich and unique as its collection of components.Both the e-book and a sample project on the use of design patterns are available now to download for free. Review the examples and decide which design pattern best suits your project. As you gain experience with them, you’ll recognize how and when they can enhance your development process. As always, we encourage you to visit the forum thread and let us know what you think of the e-book and sample.
    0 Kommentare 0 Anteile
  • Building my first multiplayer game with Netcode for GameObjects

    My name is Esteban Maldonado and I’m a developer advocate for Unity. My job is to spread the word about Unity Gaming Services and create new educational material so developers can get started with the tools for their own multiplayer development journey.One of those solutions is Netcode for GameObjects, a first-party, mid-level networking library built for the Unity game engine. A netcode solution is essential in any multiplayer development project.One of the responsibilities of a developer advocate at Unity is to create sample games that showcase our tools, and an NGO sample was assigned to me – Galactic Kittens.However, although I’ve had my good share of professional gigs in the games industry, I personally have little experience making multiplayer games – so this was going to prove to be not just a learning opportunity for developers who use the sample, but also a learning experience for me making the game in the first place.Together with my team, we fleshed out the concept of Galactic Kittens – the difficulty level of the sample, the basic mechanics, the character abilities, and more.In order to tackle this sample game project, I joined forces with the talented team at Bromio in order to make this sample game come to life with polished art assets, music and SFX, and programming support. Our combined goal was to provide developers with a simple, beginner-friendly introduction to building a multiplayer game in Unity with Netcode for GameObjects.In this blog, I’ll cover the development journey for Galactic Kittens, from prototype to stable release, and how you can leverage this sample to start your own multiplayer project.Before I dive into its development, here’s a quick overview of our new sample game Galactic Kittens. This sample is a 2D co-op space adventure designed to help you learn some basics of multiplayer networking.The sample is meant to teach you necessary techniques to get started with multiplayer development, such as:Network session management, with automatic scene switchingBasic 2D movement synchronization, including changes in sprite sheetsSpawning game objects at runtime, on server sideTransferring ownership of the main players from the server to its clientVFX creation across all connected clientsHow to play sound effects and music to all clientsCommunicating player and game statsand displaying them on the game’s UIYou can learn more about Galactic Kittens on our website, or download the sample directly from GitHub to get started exploring the code.While I didn’t have too much experience making multiplayer games, Unity does have many public resources to help users get started with using NGO.With these resources, I started very simply by familiarizing myself with basic network concepts and terminology, using our Unity Multiplayer documentation. Next, I followed the Hello World project tutorials and studied available bitesize samples to start getting some results.After some trial and error, I was able to make a simple base prototype from scratch.At this point, there was no custom lobby, no real UI, no real connection management – you get the picture. The prototype was just two equal shipsthat moved around the screen and shot a cube bullet when you pressed the spacebar. It was just enough to show object spawning and movement synchronization across clients.It was a start, but I knew that Bromio would help us reach the finish line and turn this into a workable sample.After my initial progress, I started working with Bromio on fleshing out the prototype into something more production-ready. Like me, they did not have much experience making multiplayer games, but they took on the challenge and helped us reach our goal.In order to work more efficiently, we broke down the game into isolated components to start development in parallel – with artists working on assets and programmers working on the core logic of the game.Here’s a peak at the evolution of the art style in Galactic Kittens.Meanwhile, Bromio’s main developer and I were discovering fun and challenging aspects of making Galactic Kittens into a functioning game sample.One of the biggest challenges in development was connection management and character selection. We had to store the data of the characters in separate ScriptableObject files, which you will see when you download the project.These files contain the necessary information about each space explorer, including which spritesto show on the UI and the prefabs that should be spawned for each player once the gameplay scene starts.On the character selection screen, a big challenge was to make sure to acknowledge the event of a client disconnecting and to handle that event through the UI.We decided that users should not be able to pick the same character, in order to show how developers could actually do this in their own games.The next challenge for connection management was the event of players disconnecting in the middle of a game session. This meant not only that the game had to adapt to players leaving, but also had to block other players from entering while a game is in session. We decided to make the connection manager only allow for new connections to come in while the host instance is on the character selection screen. This is not a one-size-fits-all solution – other games may allow for players to join late in an ongoing session, while other games may not – it’s up to developers to decide what’s best for their experience.We wanted to keep gameplay simple, with no complex AI or fancy behavior logic for the enemies or meteorites that players see. This way, we could provide a full game sample without taking away focus from showing users how to use the NGO library.As such, there are two main types of enemies and one meteorite obstacle: Space Shooter Space Ghost MeteoriteBoth enemies choose a random movement pattern, while the Space Shooter enemy is the only one that actually shoots back enemy lasers. Please refer to ourdeveloper guide for more information on how these enemies are built and how you can add your own logic.By the time we worked on the boss battle, all of the lessons learned from implementing the game’s lobby, player spaceship behavior, and simple enemies helped us to quickly build the final boss battle experience.One particular challenge was timing the warning alarm that you hear and see before the boss enters. In the end, we sent events with client and server RPCs in order to signal that the regular play experience was over and the final boss battle was about to begin.The behavior of the boss is structured as a finite state machinethat randomly selects which set of attacks to throw at the connected players. To do this, we used a C# class called BossController, which handles the transition from one boss state to another. Check the developer guide for information about the code behind this battle, and how you can add your own boss states.The #1 resource that helped us succeed in our mission to build this sample game was joining the Unity Multiplayer Networking Discord server and asking questions to the community. Here, we were able to actually speak with other developers who are making multiplayer games and also speak with Unity multiplayer service creators. The collective pool of knowledge was more than enough to help us reach the finish line.Working at Unity means I get to collaborate alongside networking savvy people who work hard to develop helpful resources and documentation that’s designed to assist everyone get started with multiplayer development. The Unity multiplayer documentation site came in handy many times – from familiarizing myself with basic networking terminology to dealing with latency to actually coding with NGO.We're definitely excited about Galactic Kittens. We’d like for you, and future NGO users, to use this sample as a step in the right direction toward your multiplayer learning journey. Please feel free to reach out in the Discord server or forums to ask questions or provide feedback and suggestions.One of the things I’m eager to learn is how to add object pooling to a multiplayer game sample. This is the technique that lets you pre-allocate the necessary memory for objects that get spawned repeatedly during a game session. In an earlier experiment, I tried this technique in an offline Unity project and it can definitely make an improvement to your game’s run-time efficiency. We’ve applied this technique to Boss Room and other UGS samples as well.If you’re starting out on your own multiplayer journey, then there are a lot of resources that my team at Unity provides to help make it easier for you.I would recommend starting at the Netcode for GameObjects page, where you can familiarize yourself with the package. Next, you can explore NGO through the Galactic Kittenssample or take small steps with bitesize samples.Once you’re on your journey, I recommend joining the Unity Multiplayer Networking Discord server and checking out the forums. And, if you feel like Galactic Kittens is too simple or not enough of a challenge, I would definitely encourage you to check out Boss Room, which is a complete 3D sample game that takes NGO development to a production-ready level.For taking your game online, Unity Gaming Services can help you even further – whether you’re looking to add the Lobby or Matchmaker services, voice and text chat with Vivox, or even hosting solutions like the P2P Relay service or Game Server Hosting. Happy creating!To find out more about recent trends and the future of multiplayer, read the 2022 Unity Multiplayer Report, which aggregates the results of over 1,500 survey responses across the US, UK, Japan, and Korea.
    #building #first #multiplayer #game #with
    Building my first multiplayer game with Netcode for GameObjects
    My name is Esteban Maldonado and I’m a developer advocate for Unity. My job is to spread the word about Unity Gaming Services and create new educational material so developers can get started with the tools for their own multiplayer development journey.One of those solutions is Netcode for GameObjects, a first-party, mid-level networking library built for the Unity game engine. A netcode solution is essential in any multiplayer development project.One of the responsibilities of a developer advocate at Unity is to create sample games that showcase our tools, and an NGO sample was assigned to me – Galactic Kittens.However, although I’ve had my good share of professional gigs in the games industry, I personally have little experience making multiplayer games – so this was going to prove to be not just a learning opportunity for developers who use the sample, but also a learning experience for me making the game in the first place.Together with my team, we fleshed out the concept of Galactic Kittens – the difficulty level of the sample, the basic mechanics, the character abilities, and more.In order to tackle this sample game project, I joined forces with the talented team at Bromio in order to make this sample game come to life with polished art assets, music and SFX, and programming support. Our combined goal was to provide developers with a simple, beginner-friendly introduction to building a multiplayer game in Unity with Netcode for GameObjects.In this blog, I’ll cover the development journey for Galactic Kittens, from prototype to stable release, and how you can leverage this sample to start your own multiplayer project.Before I dive into its development, here’s a quick overview of our new sample game Galactic Kittens. This sample is a 2D co-op space adventure designed to help you learn some basics of multiplayer networking.The sample is meant to teach you necessary techniques to get started with multiplayer development, such as:Network session management, with automatic scene switchingBasic 2D movement synchronization, including changes in sprite sheetsSpawning game objects at runtime, on server sideTransferring ownership of the main players from the server to its clientVFX creation across all connected clientsHow to play sound effects and music to all clientsCommunicating player and game statsand displaying them on the game’s UIYou can learn more about Galactic Kittens on our website, or download the sample directly from GitHub to get started exploring the code.While I didn’t have too much experience making multiplayer games, Unity does have many public resources to help users get started with using NGO.With these resources, I started very simply by familiarizing myself with basic network concepts and terminology, using our Unity Multiplayer documentation. Next, I followed the Hello World project tutorials and studied available bitesize samples to start getting some results.After some trial and error, I was able to make a simple base prototype from scratch.At this point, there was no custom lobby, no real UI, no real connection management – you get the picture. The prototype was just two equal shipsthat moved around the screen and shot a cube bullet when you pressed the spacebar. It was just enough to show object spawning and movement synchronization across clients.It was a start, but I knew that Bromio would help us reach the finish line and turn this into a workable sample.After my initial progress, I started working with Bromio on fleshing out the prototype into something more production-ready. Like me, they did not have much experience making multiplayer games, but they took on the challenge and helped us reach our goal.In order to work more efficiently, we broke down the game into isolated components to start development in parallel – with artists working on assets and programmers working on the core logic of the game.Here’s a peak at the evolution of the art style in Galactic Kittens.Meanwhile, Bromio’s main developer and I were discovering fun and challenging aspects of making Galactic Kittens into a functioning game sample.One of the biggest challenges in development was connection management and character selection. We had to store the data of the characters in separate ScriptableObject files, which you will see when you download the project.These files contain the necessary information about each space explorer, including which spritesto show on the UI and the prefabs that should be spawned for each player once the gameplay scene starts.On the character selection screen, a big challenge was to make sure to acknowledge the event of a client disconnecting and to handle that event through the UI.We decided that users should not be able to pick the same character, in order to show how developers could actually do this in their own games.The next challenge for connection management was the event of players disconnecting in the middle of a game session. This meant not only that the game had to adapt to players leaving, but also had to block other players from entering while a game is in session. We decided to make the connection manager only allow for new connections to come in while the host instance is on the character selection screen. This is not a one-size-fits-all solution – other games may allow for players to join late in an ongoing session, while other games may not – it’s up to developers to decide what’s best for their experience.We wanted to keep gameplay simple, with no complex AI or fancy behavior logic for the enemies or meteorites that players see. This way, we could provide a full game sample without taking away focus from showing users how to use the NGO library.As such, there are two main types of enemies and one meteorite obstacle: Space Shooter Space Ghost MeteoriteBoth enemies choose a random movement pattern, while the Space Shooter enemy is the only one that actually shoots back enemy lasers. Please refer to ourdeveloper guide for more information on how these enemies are built and how you can add your own logic.By the time we worked on the boss battle, all of the lessons learned from implementing the game’s lobby, player spaceship behavior, and simple enemies helped us to quickly build the final boss battle experience.One particular challenge was timing the warning alarm that you hear and see before the boss enters. In the end, we sent events with client and server RPCs in order to signal that the regular play experience was over and the final boss battle was about to begin.The behavior of the boss is structured as a finite state machinethat randomly selects which set of attacks to throw at the connected players. To do this, we used a C# class called BossController, which handles the transition from one boss state to another. Check the developer guide for information about the code behind this battle, and how you can add your own boss states.The #1 resource that helped us succeed in our mission to build this sample game was joining the Unity Multiplayer Networking Discord server and asking questions to the community. Here, we were able to actually speak with other developers who are making multiplayer games and also speak with Unity multiplayer service creators. The collective pool of knowledge was more than enough to help us reach the finish line.Working at Unity means I get to collaborate alongside networking savvy people who work hard to develop helpful resources and documentation that’s designed to assist everyone get started with multiplayer development. The Unity multiplayer documentation site came in handy many times – from familiarizing myself with basic networking terminology to dealing with latency to actually coding with NGO.We're definitely excited about Galactic Kittens. We’d like for you, and future NGO users, to use this sample as a step in the right direction toward your multiplayer learning journey. Please feel free to reach out in the Discord server or forums to ask questions or provide feedback and suggestions.One of the things I’m eager to learn is how to add object pooling to a multiplayer game sample. This is the technique that lets you pre-allocate the necessary memory for objects that get spawned repeatedly during a game session. In an earlier experiment, I tried this technique in an offline Unity project and it can definitely make an improvement to your game’s run-time efficiency. We’ve applied this technique to Boss Room and other UGS samples as well.If you’re starting out on your own multiplayer journey, then there are a lot of resources that my team at Unity provides to help make it easier for you.I would recommend starting at the Netcode for GameObjects page, where you can familiarize yourself with the package. Next, you can explore NGO through the Galactic Kittenssample or take small steps with bitesize samples.Once you’re on your journey, I recommend joining the Unity Multiplayer Networking Discord server and checking out the forums. And, if you feel like Galactic Kittens is too simple or not enough of a challenge, I would definitely encourage you to check out Boss Room, which is a complete 3D sample game that takes NGO development to a production-ready level.For taking your game online, Unity Gaming Services can help you even further – whether you’re looking to add the Lobby or Matchmaker services, voice and text chat with Vivox, or even hosting solutions like the P2P Relay service or Game Server Hosting. Happy creating!To find out more about recent trends and the future of multiplayer, read the 2022 Unity Multiplayer Report, which aggregates the results of over 1,500 survey responses across the US, UK, Japan, and Korea. #building #first #multiplayer #game #with
    UNITY.COM
    Building my first multiplayer game with Netcode for GameObjects
    My name is Esteban Maldonado and I’m a developer advocate for Unity. My job is to spread the word about Unity Gaming Services and create new educational material so developers can get started with the tools for their own multiplayer development journey.One of those solutions is Netcode for GameObjects (NGO), a first-party, mid-level networking library built for the Unity game engine. A netcode solution is essential in any multiplayer development project.One of the responsibilities of a developer advocate at Unity is to create sample games that showcase our tools, and an NGO sample was assigned to me – Galactic Kittens.However, although I’ve had my good share of professional gigs in the games industry, I personally have little experience making multiplayer games – so this was going to prove to be not just a learning opportunity for developers who use the sample, but also a learning experience for me making the game in the first place.Together with my team, we fleshed out the concept of Galactic Kittens – the difficulty level of the sample, the basic mechanics, the character abilities (which were later removed), and more.In order to tackle this sample game project, I joined forces with the talented team at Bromio in order to make this sample game come to life with polished art assets, music and SFX, and programming support. Our combined goal was to provide developers with a simple, beginner-friendly introduction to building a multiplayer game in Unity with Netcode for GameObjects.In this blog, I’ll cover the development journey for Galactic Kittens, from prototype to stable release, and how you can leverage this sample to start your own multiplayer project.Before I dive into its development, here’s a quick overview of our new sample game Galactic Kittens. This sample is a 2D co-op space adventure designed to help you learn some basics of multiplayer networking.The sample is meant to teach you necessary techniques to get started with multiplayer development, such as:Network session management, with automatic scene switchingBasic 2D movement synchronization, including changes in sprite sheetsSpawning game objects at runtime, on server sideTransferring ownership of the main players from the server to its clientVFX creation across all connected clientsHow to play sound effects and music to all clientsCommunicating player and game stats (health, enemies defeated, etc.) and displaying them on the game’s UIYou can learn more about Galactic Kittens on our website, or download the sample directly from GitHub to get started exploring the code.While I didn’t have too much experience making multiplayer games, Unity does have many public resources to help users get started with using NGO.With these resources, I started very simply by familiarizing myself with basic network concepts and terminology, using our Unity Multiplayer documentation. Next, I followed the Hello World project tutorials and studied available bitesize samples to start getting some results.After some trial and error, I was able to make a simple base prototype from scratch.At this point, there was no custom lobby, no real UI, no real connection management – you get the picture. The prototype was just two equal ships (with three Hit Points each) that moved around the screen and shot a cube bullet when you pressed the spacebar. It was just enough to show object spawning and movement synchronization across clients.It was a start, but I knew that Bromio would help us reach the finish line and turn this into a workable sample.After my initial progress, I started working with Bromio on fleshing out the prototype into something more production-ready. Like me, they did not have much experience making multiplayer games, but they took on the challenge and helped us reach our goal.In order to work more efficiently, we broke down the game into isolated components to start development in parallel – with artists working on assets and programmers working on the core logic of the game.Here’s a peak at the evolution of the art style in Galactic Kittens.Meanwhile, Bromio’s main developer and I were discovering fun and challenging aspects of making Galactic Kittens into a functioning game sample.One of the biggest challenges in development was connection management and character selection. We had to store the data of the characters in separate ScriptableObject files, which you will see when you download the project.These files contain the necessary information about each space explorer, including which sprites (player and ship) to show on the UI and the prefabs that should be spawned for each player once the gameplay scene starts.On the character selection screen, a big challenge was to make sure to acknowledge the event of a client disconnecting and to handle that event through the UI.We decided that users should not be able to pick the same character, in order to show how developers could actually do this in their own games. (It's actually easier to let players pick the same character since there’s no additional restriction.)The next challenge for connection management was the event of players disconnecting in the middle of a game session. This meant not only that the game had to adapt to players leaving, but also had to block other players from entering while a game is in session. We decided to make the connection manager only allow for new connections to come in while the host instance is on the character selection screen. This is not a one-size-fits-all solution – other games may allow for players to join late in an ongoing session, while other games may not – it’s up to developers to decide what’s best for their experience.We wanted to keep gameplay simple, with no complex AI or fancy behavior logic for the enemies or meteorites that players see. This way, we could provide a full game sample without taking away focus from showing users how to use the NGO library.As such, there are two main types of enemies and one meteorite obstacle: Space Shooter Space Ghost MeteoriteBoth enemies choose a random movement pattern, while the Space Shooter enemy is the only one that actually shoots back enemy lasers. Please refer to ourdeveloper guide for more information on how these enemies are built and how you can add your own logic.By the time we worked on the boss battle, all of the lessons learned from implementing the game’s lobby, player spaceship behavior, and simple enemies helped us to quickly build the final boss battle experience.One particular challenge was timing the warning alarm that you hear and see before the boss enters. In the end, we sent events with client and server RPCs in order to signal that the regular play experience was over and the final boss battle was about to begin.The behavior of the boss is structured as a finite state machine (FSM) that randomly selects which set of attacks to throw at the connected players. To do this, we used a C# class called BossController, which handles the transition from one boss state to another. Check the developer guide for information about the code behind this battle, and how you can add your own boss states.The #1 resource that helped us succeed in our mission to build this sample game was joining the Unity Multiplayer Networking Discord server and asking questions to the community. Here, we were able to actually speak with other developers who are making multiplayer games and also speak with Unity multiplayer service creators. The collective pool of knowledge was more than enough to help us reach the finish line.Working at Unity means I get to collaborate alongside networking savvy people who work hard to develop helpful resources and documentation that’s designed to assist everyone get started with multiplayer development. The Unity multiplayer documentation site came in handy many times – from familiarizing myself with basic networking terminology to dealing with latency to actually coding with NGO.We're definitely excited about Galactic Kittens. We’d like for you, and future NGO users, to use this sample as a step in the right direction toward your multiplayer learning journey. Please feel free to reach out in the Discord server or forums to ask questions or provide feedback and suggestions.One of the things I’m eager to learn is how to add object pooling to a multiplayer game sample. This is the technique that lets you pre-allocate the necessary memory for objects that get spawned repeatedly during a game session. In an earlier experiment, I tried this technique in an offline Unity project and it can definitely make an improvement to your game’s run-time efficiency. We’ve applied this technique to Boss Room and other UGS samples as well.If you’re starting out on your own multiplayer journey, then there are a lot of resources that my team at Unity provides to help make it easier for you.I would recommend starting at the Netcode for GameObjects page, where you can familiarize yourself with the package. Next, you can explore NGO through the Galactic Kittenssample or take small steps with bitesize samples.Once you’re on your journey, I recommend joining the Unity Multiplayer Networking Discord server and checking out the forums. And, if you feel like Galactic Kittens is too simple or not enough of a challenge, I would definitely encourage you to check out Boss Room, which is a complete 3D sample game that takes NGO development to a production-ready level.For taking your game online, Unity Gaming Services can help you even further – whether you’re looking to add the Lobby or Matchmaker services, voice and text chat with Vivox, or even hosting solutions like the P2P Relay service or Game Server Hosting. Happy creating!To find out more about recent trends and the future of multiplayer, read the 2022 Unity Multiplayer Report, which aggregates the results of over 1,500 survey responses across the US, UK, Japan, and Korea.
    0 Kommentare 0 Anteile
  • Advanced Editor scripting hacks to save you time, part 2

    I’m back for part two! If you missed the first installment of my advanced Editor scripting hacks, check it out here. This two-part article is designed to walk you through advanced Editor tips for improving workflows so that your next project runs smoother than your last.Each hack is based on a demonstrative prototype I set up – similar to an RTS – where the units of one team automatically attack enemy buildings and other units. For a refresher, here’s the initial build prototype:In the previous article, I shared best practices on how to import and set up the art assets in the project. Now let’s start using those assets in the game, while saving as much time as possible.Let’s begin by unpacking the game’s elements. When setting up the elements of a game, we often encounter the following scenario:On one hand, we have Prefabs that come from the art team – be it a Prefab generated by the FBX Importer, or a Prefab that has been carefully set up with all the appropriate materials and animations, adding props to the Hierarchy, etc. To use this Prefab in-game, it makes sense to create a Prefab Variant from it and add all the gameplay-related components there. This way, the art team can modify and update the Prefab, and all the changes are reflected immediately in the game. While this approach works if the item only requires a couple of components with simple settings, it can add a lot of work if you need to set up something complex from scratch every time.On the other hand, many of the items will have the same components with similar values, like all the Car Prefabs or Prefabs for similar enemies. It makes sense that they’re all Variants of the same base Prefab. That said, this approach is ideal if setting up the art of the Prefab is straightforward.Next, let’s look at how to simplify the setup of gameplay components, so we can quickly add them to our art Prefabs and use them directly in the game.The most common setup I’ve seen for complex elements in a game is having a “main” componentthat behaves as an interface to communicate with the object, and a series of small, reusable components that implement the functionality itself; things like “selectable,” “CharacterMovement,” or “UnitHealth,” and Unity built-in components, like renderers and colliders.Some of the components depend on other components in order to work. For instance, the character movement might need a NavMesh agent. That’s why Unity has the RequireComponent attribute ready to define all these dependencies. So if there’s a “main” component for a given type of object, you can use the RequireComponent attribute to add all the components that this type of object needs to have.For example, the units in my prototype have these attributes:Besides setting an easy-to-find location in the AddComponentMenu, include all the extra components it needs. In this case, I added the Locomotion to move around and the AttackComponent to attack other units.Additionally, the base class unithas other RequireComponent attributes that are inherited by this class, such as the Health component. With this, I only need to add the Soldier component to a GameObject so that all the other components are added automatically. If I add a new RequireComponent attribute to a component, Unity will update all the existing GameObjects with the new component, which facilitates extending the existing objects.RequireComponent also has a more subtle benefit: If we have “component A” that requires “component B,” then adding A to a GameObject doesn’t just ensure that B is added as well – it actually ensures that B is added before A. This means that when the Reset method is called for component A, component B will already exist and we’ll readily have access to it. This enables us to set references to the components, register persistent UnityEvents, and anything else we need to do to set up the object. By combining the RequireComponent attribute and the Reset method, we can fully set up the object by adding a single component.The main drawback of the method shown above is that, if we decide to change a value, we will need to change it for every object manually. And if all the setup is done through code, it becomes difficult for designers to modify it.In the previous article, we looked at how to use AssetPostprocessor for adding dependencies and modifying objects at import time. Now let’s use this to enforce some values in our Prefabs.To make it easier for designers to modify those values, we will read the values from a Prefab. Doing so allows the designers to easily modify that Prefab to change the values for the entire project.If you’re writing Editor code, you can copy the values from a component in an object to another by taking advantage of the Preset class.Create a preset from the original component and apply it to the other componentlike this:As it stands, it will override all the values in the Prefab, but this most probably isn’t what we want it to do. Instead, copy only some values, while keeping the rest intact. To do this, use another override of the Preset.ApplyTo that takes a list of the properties it must apply. Of course, we could easily create a hardcoded list of the properties we want to override, which would work fine for most projects, but let’s see how to make this completely generic.Basically, I created a base Prefab with all the components, and then created a Variant to use as a template. Then I decided what values to apply from the list of overrides in the Variant.To get the overrides, use PrefabUtility.GetPropertyModifications. This provides you with all the overrides in the entire Prefab, so filter only the ones necessary to target this component. Something to keep in mind here is that the target of the modification is the component of the base Prefab – not the component of the Variant – so we need to get the reference to it by using GetCorrespondingObjectFrom
    #advanced #editor #scripting #hacks #save
    Advanced Editor scripting hacks to save you time, part 2
    I’m back for part two! If you missed the first installment of my advanced Editor scripting hacks, check it out here. This two-part article is designed to walk you through advanced Editor tips for improving workflows so that your next project runs smoother than your last.Each hack is based on a demonstrative prototype I set up – similar to an RTS – where the units of one team automatically attack enemy buildings and other units. For a refresher, here’s the initial build prototype:In the previous article, I shared best practices on how to import and set up the art assets in the project. Now let’s start using those assets in the game, while saving as much time as possible.Let’s begin by unpacking the game’s elements. When setting up the elements of a game, we often encounter the following scenario:On one hand, we have Prefabs that come from the art team – be it a Prefab generated by the FBX Importer, or a Prefab that has been carefully set up with all the appropriate materials and animations, adding props to the Hierarchy, etc. To use this Prefab in-game, it makes sense to create a Prefab Variant from it and add all the gameplay-related components there. This way, the art team can modify and update the Prefab, and all the changes are reflected immediately in the game. While this approach works if the item only requires a couple of components with simple settings, it can add a lot of work if you need to set up something complex from scratch every time.On the other hand, many of the items will have the same components with similar values, like all the Car Prefabs or Prefabs for similar enemies. It makes sense that they’re all Variants of the same base Prefab. That said, this approach is ideal if setting up the art of the Prefab is straightforward.Next, let’s look at how to simplify the setup of gameplay components, so we can quickly add them to our art Prefabs and use them directly in the game.The most common setup I’ve seen for complex elements in a game is having a “main” componentthat behaves as an interface to communicate with the object, and a series of small, reusable components that implement the functionality itself; things like “selectable,” “CharacterMovement,” or “UnitHealth,” and Unity built-in components, like renderers and colliders.Some of the components depend on other components in order to work. For instance, the character movement might need a NavMesh agent. That’s why Unity has the RequireComponent attribute ready to define all these dependencies. So if there’s a “main” component for a given type of object, you can use the RequireComponent attribute to add all the components that this type of object needs to have.For example, the units in my prototype have these attributes:Besides setting an easy-to-find location in the AddComponentMenu, include all the extra components it needs. In this case, I added the Locomotion to move around and the AttackComponent to attack other units.Additionally, the base class unithas other RequireComponent attributes that are inherited by this class, such as the Health component. With this, I only need to add the Soldier component to a GameObject so that all the other components are added automatically. If I add a new RequireComponent attribute to a component, Unity will update all the existing GameObjects with the new component, which facilitates extending the existing objects.RequireComponent also has a more subtle benefit: If we have “component A” that requires “component B,” then adding A to a GameObject doesn’t just ensure that B is added as well – it actually ensures that B is added before A. This means that when the Reset method is called for component A, component B will already exist and we’ll readily have access to it. This enables us to set references to the components, register persistent UnityEvents, and anything else we need to do to set up the object. By combining the RequireComponent attribute and the Reset method, we can fully set up the object by adding a single component.The main drawback of the method shown above is that, if we decide to change a value, we will need to change it for every object manually. And if all the setup is done through code, it becomes difficult for designers to modify it.In the previous article, we looked at how to use AssetPostprocessor for adding dependencies and modifying objects at import time. Now let’s use this to enforce some values in our Prefabs.To make it easier for designers to modify those values, we will read the values from a Prefab. Doing so allows the designers to easily modify that Prefab to change the values for the entire project.If you’re writing Editor code, you can copy the values from a component in an object to another by taking advantage of the Preset class.Create a preset from the original component and apply it to the other componentlike this:As it stands, it will override all the values in the Prefab, but this most probably isn’t what we want it to do. Instead, copy only some values, while keeping the rest intact. To do this, use another override of the Preset.ApplyTo that takes a list of the properties it must apply. Of course, we could easily create a hardcoded list of the properties we want to override, which would work fine for most projects, but let’s see how to make this completely generic.Basically, I created a base Prefab with all the components, and then created a Variant to use as a template. Then I decided what values to apply from the list of overrides in the Variant.To get the overrides, use PrefabUtility.GetPropertyModifications. This provides you with all the overrides in the entire Prefab, so filter only the ones necessary to target this component. Something to keep in mind here is that the target of the modification is the component of the base Prefab – not the component of the Variant – so we need to get the reference to it by using GetCorrespondingObjectFrom #advanced #editor #scripting #hacks #save
    UNITY.COM
    Advanced Editor scripting hacks to save you time, part 2
    I’m back for part two! If you missed the first installment of my advanced Editor scripting hacks, check it out here. This two-part article is designed to walk you through advanced Editor tips for improving workflows so that your next project runs smoother than your last.Each hack is based on a demonstrative prototype I set up – similar to an RTS – where the units of one team automatically attack enemy buildings and other units. For a refresher, here’s the initial build prototype:In the previous article, I shared best practices on how to import and set up the art assets in the project. Now let’s start using those assets in the game, while saving as much time as possible.Let’s begin by unpacking the game’s elements. When setting up the elements of a game, we often encounter the following scenario:On one hand, we have Prefabs that come from the art team – be it a Prefab generated by the FBX Importer, or a Prefab that has been carefully set up with all the appropriate materials and animations, adding props to the Hierarchy, etc. To use this Prefab in-game, it makes sense to create a Prefab Variant from it and add all the gameplay-related components there. This way, the art team can modify and update the Prefab, and all the changes are reflected immediately in the game. While this approach works if the item only requires a couple of components with simple settings, it can add a lot of work if you need to set up something complex from scratch every time.On the other hand, many of the items will have the same components with similar values, like all the Car Prefabs or Prefabs for similar enemies. It makes sense that they’re all Variants of the same base Prefab. That said, this approach is ideal if setting up the art of the Prefab is straightforward (i.e., setting the mesh and its materials).Next, let’s look at how to simplify the setup of gameplay components, so we can quickly add them to our art Prefabs and use them directly in the game.The most common setup I’ve seen for complex elements in a game is having a “main” component (like “enemy,” “pickup,” or “door”) that behaves as an interface to communicate with the object, and a series of small, reusable components that implement the functionality itself; things like “selectable,” “CharacterMovement,” or “UnitHealth,” and Unity built-in components, like renderers and colliders.Some of the components depend on other components in order to work. For instance, the character movement might need a NavMesh agent. That’s why Unity has the RequireComponent attribute ready to define all these dependencies. So if there’s a “main” component for a given type of object, you can use the RequireComponent attribute to add all the components that this type of object needs to have.For example, the units in my prototype have these attributes:Besides setting an easy-to-find location in the AddComponentMenu, include all the extra components it needs. In this case, I added the Locomotion to move around and the AttackComponent to attack other units.Additionally, the base class unit (which is shared with the buildings) has other RequireComponent attributes that are inherited by this class, such as the Health component. With this, I only need to add the Soldier component to a GameObject so that all the other components are added automatically. If I add a new RequireComponent attribute to a component, Unity will update all the existing GameObjects with the new component, which facilitates extending the existing objects.RequireComponent also has a more subtle benefit: If we have “component A” that requires “component B,” then adding A to a GameObject doesn’t just ensure that B is added as well – it actually ensures that B is added before A. This means that when the Reset method is called for component A, component B will already exist and we’ll readily have access to it. This enables us to set references to the components, register persistent UnityEvents, and anything else we need to do to set up the object. By combining the RequireComponent attribute and the Reset method, we can fully set up the object by adding a single component.The main drawback of the method shown above is that, if we decide to change a value, we will need to change it for every object manually. And if all the setup is done through code, it becomes difficult for designers to modify it.In the previous article, we looked at how to use AssetPostprocessor for adding dependencies and modifying objects at import time. Now let’s use this to enforce some values in our Prefabs.To make it easier for designers to modify those values, we will read the values from a Prefab. Doing so allows the designers to easily modify that Prefab to change the values for the entire project.If you’re writing Editor code, you can copy the values from a component in an object to another by taking advantage of the Preset class.Create a preset from the original component and apply it to the other component(s) like this:As it stands, it will override all the values in the Prefab, but this most probably isn’t what we want it to do. Instead, copy only some values, while keeping the rest intact. To do this, use another override of the Preset.ApplyTo that takes a list of the properties it must apply. Of course, we could easily create a hardcoded list of the properties we want to override, which would work fine for most projects, but let’s see how to make this completely generic.Basically, I created a base Prefab with all the components, and then created a Variant to use as a template. Then I decided what values to apply from the list of overrides in the Variant.To get the overrides, use PrefabUtility.GetPropertyModifications. This provides you with all the overrides in the entire Prefab, so filter only the ones necessary to target this component. Something to keep in mind here is that the target of the modification is the component of the base Prefab – not the component of the Variant – so we need to get the reference to it by using GetCorrespondingObjectFromSource:Now this will apply all overrides of the template to our Prefabs. The only detail left is that the template might be a Variant of a Variant, and we will want to apply the overrides from that Variant as well.To do this, we only need to make this recursive:Next, let’s find the template for our Prefabs. Ideally, we will want to use different templates for different types of objects. One efficient way of doing this is by placing the templates in the same folder as the objects we want to apply them to.Look for an object named Template.prefab in the same folder as our Prefab. If we can’t find it, we will look in the parent folder recursively:At this point, we have the ability to modify the template Prefab, and all the changes will be reflected in the Prefabs in that folder, even though they aren’t Variants of the template. In this example, I changed the default player color (the color used when the unit isn’t attached to any player). Notice how it updates all the objects:When balancing games, all the stats you’ll need to adjust are spread across various components, stored in one Prefab or ScriptableObject for every character. This makes the process of adjusting details rather slow.A common way to make balancing easier is by using spreadsheets. They can be very handy as they bring all the data together, and you can use formulas to automatically calculate some of the additional data. But entering this data into Unity manually can be painfully long.That’s where the spreadsheets come in. They can be exported to simple formats like CSV(.csv) or TSV(.tsv), which is exactly what ScriptedImporters are for. Below is a screen capture of the stats for the units in the prototype:The code for this is pretty simple: Create a ScriptableObject with all the stats for a unit, then you can read the file. For every row of the table, create an instance of the ScriptableObject and fill it with the data for that row.Finally, add all the ScriptableObjects to the imported asset by using the context. We also need to add a main asset, which I just set to an empty TextAsset (as we don’t really use the main asset for anything here).This works for both buildings and units, but you should check which one you’re importing as units will have many more stats.With this complete, there are now some ScriptableObjects that contain all of the data from the spreadsheet.The generated ScriptableObjects are ready to be used in the game as needed. You can also use the PrefabPostprocessor that was set up earlier.In the OnPostprocessPrefab method, we have the capacity to load this asset and use its data to fill the parameters of the components automatically. Even more, if you set a dependency to this data asset, the Prefabs will be reimported every time you modify the data, keeping everything up to date automatically.When trying to create awesome levels, it’s crucial to be able to change and test things quickly, making small adjustments and trying again. That’s why fast iteration times and reducing the steps needed to start testing are so important.One of the first things that we think of when it comes to iteration times in Unity is the Domain Reload. The Domain Reload is relevant in two key situations: after compiling code in order to load the new dynamically linked libraries (DLLs), and when entering and exiting Play Mode. Domain Reload that comes with compiling can’t be avoided, but you do have the option of disabling reloads related to Play Mode in Project Settings > Editor > Enter Play Mode Settings.Disabling the Domain Reload when entering Play Mode can cause some issues if your code isn’t prepared for it, with the most usual issue being that static variables aren’t reset after playing. If your code can work with this disabled, go for it. For this prototype, Domain Reload is disabled, so you can enter Play Mode almost instantaneously.A separate issue with iteration times has to do with recalculating data that is required in order to play. This often involves selecting some components and clicking on buttons to trigger the recalculations. For example, in this prototype, there is a TeamController for each team within the scene. This controller has a list of all the enemy buildings so that it can send the units to attack them. In order to fill this data automatically, use the IProcessSceneWithReport interface. This interface is called for the scenes on two different occasions: during builds and when loading a scene in Play Mode. With it comes the opportunity to create, destroy, and modify any object you want. Note, however, that these changes will only affect Builds and Play Mode.It is in this callback that the controllers are created and the list of buildings is set. Thanks to this, there is no need to do anything manually. The controllers with an updated list of buildings will be there when play starts, and the list will be updated with the changes we’ve made.For the prototype, a utility method was set up that allows you to get all the instances of a component in a scene. You can use this to get all the buildings:The rest of the process is somewhat trivial: Get all the buildings, get all the teams that the buildings belong to, and create a controller for every team with a list of enemy buildings.Besides the scene being edited, you also need to load other scenes in order to play (i.e., a scene with the managers, with the UI, etc.) This can take up valuable time. In the case of the prototype, the Canvas with the healthbars is in a different scene called InGameUI.An effective way of working with this is by adding a component to the scene with a list of the scenes that need to be loaded along with it. If you load those scenes synchronously in the Awake method, the scene will be loaded and all of its Awake methods will be invoked at that point. So by the time the Start method is called, you can be sure that all the scenes are loaded and initialized, which gives you access to the data in them, such as manager singletons.Remember that you might have some of the scenes open when you enter Play Mode, so it’s important to check whether the scene is already loaded before loading it:Throughout parts one and two of this article, I’ve shown you how to leverage some of the lesser known features that Unity has to offer. Everything outlined is just a fraction of what can be done, but I hope that you’ll find these hacks useful for your next project, or – at the very least – interesting.The assets used to create the prototype can be found for free in the Asset Store:Skeletons: Toon RTS Units – Undead DemoKnights: Toon RTS Units – DemoTowers: Awesome Stylized Mage TowerIf you’d like to discuss this two-parter, or share your ideas after reading it, head on over to our Scripting forum. I’m signing off for now but you can still connect with me on Twitter at @CaballolD. Be sure to stay tuned for future technical blogs from other Unity developers as part of the ongoing Tech from the Trenches series.
    0 Kommentare 0 Anteile
  • What’s new for Prefabs in 2022.2?

    It’s been a while since the Scene Management team has shared an update on Prefabs. During the last few releases, and after fixing a large number of bugs you’ve reported, we’ve made several improvements to the Prefab system. Let’s take a look at each improvement coming in 2022.2 – now available in beta – and how these updates can benefit you.You can now replace the Prefab Asset for a Prefab instance that exists either in a scene or nested inside other Prefabs. This feature will keep the Prefab instance position, rotation, and scale in the scene, but merge the contents from the new Prefab Asset, all while retaining as many overrides and references as possible via name-based matching. More specifically:The Inspector for a Prefab instance has a new Object Field that can be used for replacing the Prefab Asset.The Hierarchy has Context Menus that can similarly replace the Prefab Asset of the instance.Finally, a plain GameObject can be converted to a Prefab instance through the Context Menu in the Hierarchy, or by dragging and dropping with the Ctrl/Cmd modifier key.This functionality is not only available in the UI, but as with most features we build, it has an API that allows you to manage how objects are matched, as well as how Overrides should be treated. See PrefabUtility.ReplacePrefabAssetOfPrefabInstanceand PrefabUtility.ConvertToPrefabInstance.One of the most requested improvements has been the ability to reorder added GameObjects and components. “Added GameObjects and components” refers to the GameObjects and components that are not part of a Prefab instance, but are added to the Prefab instance in a scene or inside a Variant or Nested Prefab. So as of 2022.1, it is possible to reorder the added GameObjects by drag and drop – both among themselves and between GameObjects belonging to the Prefab instance. Getting this feature ready has required a major refactoring of the Undo system.If you want to reorder added GameObjects from an Editor script, it is simply a matter of setting the sibling index on the Transform of the added GameObject. The ability to reorder added components in the Inspector is included in 2022.2. There is no public API for reordering components.The last thing we needed to achieve full feature parity between GameObjects and components was the ability to delete GameObjects from Prefab instances as an Override. Deleting GameObjects as Overrides, an option available in 2022.2, ensures that once you’ve deleted a GameObject, the usual workflows for reverting from/applying to a Prefab Asset works as you’d expect.When it comes to an Editor script, use Object.DestroyImmediate to destroy Prefab instance objects and record the destruction as an Override stored in the scene file.Users often ask what the Variant inheritance tree looks like for a specific Prefab Asset. In 2022.2, we added the Prefab Family pop-up to the Inspector. The content of the pop-up is dependent on the selected Prefab Asset in the Project Browser. After selecting a Prefab Asset and opening the Prefab Family pop-up, the Editor lists all the ancestors of the current Prefab, as well as all the immediate children.In addition to queries about the inheritance tree, users have often asked how they can get rid of unused Overrides stored in a scene but never accessed. In the worst case, such properties might reference assets that are then pulled into the final build, taking up space on the storage device and in memory – but never used.Overrides are now flagged as unused for:Null target objectsUnknown Property PathsRemoved componentsRemoved GameObjectsChanged array dimensionsWhen selecting one or more Prefab instances in the Hierarchy and opening the Overrides drop-down, the Editor now shows whether there are unused Overrides. You can then remove them from the scene using the new Unused Overrides drop-down.Moreover, you can remove all unused Overrides in a scene through the Hierarchy’s Scene Context Menu or via the Context Menu for an arbitrary selection of Prefab instances.We do not automatically remove unused Overrides. After all, the reason for their existence cannot be inferred. Removing a property from a script or deleting an asset should not automatically remove unused Overrides as you might subsequently wish to undo the removal and have the Overrides restored.In case you’re wondering: “Why do I still have Overrides on my Prefab instance after pressing ‘Apply All’?” The answer is that those Overrides simply can’t be applied to the Prefab Asset. Most commonly, such Overrides are references to other objects in the scene that cannot be referenced from the Prefab Asset. Overrides that are not typically applicable are now highlighted by a dark blue bar in the Inspector. These cannot be applied; only reverted.You can now change the default behavior when opening Prefab Mode to In Isolation instead of In Context. Go to Editor Preferences > General > Default Prefab Mode to make this change.Now, with 2022.2, Undo is recorded as a single Undo operation when exiting Prefab Mode. This results in all changes made to the Prefab being reverted if you perform an Undo after leaving Prefab Mode.Over the course of multiple releases, the error handling and reporting during scene loadhas substantially improved, and will now indicate which Prefabs the errors are related to and/or the GUID for missing Prefabs. In fact, the way we handle missing Prefabs’ assets during scene loading is safer and more stable than before.In an effort to further improve error handling and avoid introducing bad data into your project, we’ve added a Broken Prefab Asset Type, which will be produced by the Prefab Importer when errors that cannot be rectified are encountered.The most common case is when a Prefab Variant has lost its parent Prefab, perhaps because it was deleted. In this case, we can’t produce a meaningful Prefab Variant, so a Broken Prefab Asset is created instead. This new asset will show information about what is wrong in the Inspector when selected in the Project Browser. If it’s a case of a missing Prefab parent, then the GUID of the missing Prefab is shown. Alternatively, if it’s a chain of Prefab Variants that is broken, you can go up the chain through the Inspector until you find the Variant with the missing parent.The concept of Disconnected Prefab instances no longer exists as of 2022.1. We still support loading Disconnected Prefab instances, but when the Editor encounters them during scene loading, the Disconnected Prefab instances are stripped of all their Prefab information and become regular GameObjects.As mentioned, our team has fixed a series of bugs you’ve graciously reported to us over time. Some of them derive from the original Prefab system, but many have only become apparent upon the introduction of our improved Prefabs.Today, we are confident you will enjoy the stability of the latest Prefab system. We hope you will find it smooth and efficient to work with.Have more Prefab-related questions or comments? Join us in the forums to share your feedback.
    #whats #new #prefabs
    What’s new for Prefabs in 2022.2?
    It’s been a while since the Scene Management team has shared an update on Prefabs. During the last few releases, and after fixing a large number of bugs you’ve reported, we’ve made several improvements to the Prefab system. Let’s take a look at each improvement coming in 2022.2 – now available in beta – and how these updates can benefit you.You can now replace the Prefab Asset for a Prefab instance that exists either in a scene or nested inside other Prefabs. This feature will keep the Prefab instance position, rotation, and scale in the scene, but merge the contents from the new Prefab Asset, all while retaining as many overrides and references as possible via name-based matching. More specifically:The Inspector for a Prefab instance has a new Object Field that can be used for replacing the Prefab Asset.The Hierarchy has Context Menus that can similarly replace the Prefab Asset of the instance.Finally, a plain GameObject can be converted to a Prefab instance through the Context Menu in the Hierarchy, or by dragging and dropping with the Ctrl/Cmd modifier key.This functionality is not only available in the UI, but as with most features we build, it has an API that allows you to manage how objects are matched, as well as how Overrides should be treated. See PrefabUtility.ReplacePrefabAssetOfPrefabInstanceand PrefabUtility.ConvertToPrefabInstance.One of the most requested improvements has been the ability to reorder added GameObjects and components. “Added GameObjects and components” refers to the GameObjects and components that are not part of a Prefab instance, but are added to the Prefab instance in a scene or inside a Variant or Nested Prefab. So as of 2022.1, it is possible to reorder the added GameObjects by drag and drop – both among themselves and between GameObjects belonging to the Prefab instance. Getting this feature ready has required a major refactoring of the Undo system.If you want to reorder added GameObjects from an Editor script, it is simply a matter of setting the sibling index on the Transform of the added GameObject. The ability to reorder added components in the Inspector is included in 2022.2. There is no public API for reordering components.The last thing we needed to achieve full feature parity between GameObjects and components was the ability to delete GameObjects from Prefab instances as an Override. Deleting GameObjects as Overrides, an option available in 2022.2, ensures that once you’ve deleted a GameObject, the usual workflows for reverting from/applying to a Prefab Asset works as you’d expect.When it comes to an Editor script, use Object.DestroyImmediate to destroy Prefab instance objects and record the destruction as an Override stored in the scene file.Users often ask what the Variant inheritance tree looks like for a specific Prefab Asset. In 2022.2, we added the Prefab Family pop-up to the Inspector. The content of the pop-up is dependent on the selected Prefab Asset in the Project Browser. After selecting a Prefab Asset and opening the Prefab Family pop-up, the Editor lists all the ancestors of the current Prefab, as well as all the immediate children.In addition to queries about the inheritance tree, users have often asked how they can get rid of unused Overrides stored in a scene but never accessed. In the worst case, such properties might reference assets that are then pulled into the final build, taking up space on the storage device and in memory – but never used.Overrides are now flagged as unused for:Null target objectsUnknown Property PathsRemoved componentsRemoved GameObjectsChanged array dimensionsWhen selecting one or more Prefab instances in the Hierarchy and opening the Overrides drop-down, the Editor now shows whether there are unused Overrides. You can then remove them from the scene using the new Unused Overrides drop-down.Moreover, you can remove all unused Overrides in a scene through the Hierarchy’s Scene Context Menu or via the Context Menu for an arbitrary selection of Prefab instances.We do not automatically remove unused Overrides. After all, the reason for their existence cannot be inferred. Removing a property from a script or deleting an asset should not automatically remove unused Overrides as you might subsequently wish to undo the removal and have the Overrides restored.In case you’re wondering: “Why do I still have Overrides on my Prefab instance after pressing ‘Apply All’?” The answer is that those Overrides simply can’t be applied to the Prefab Asset. Most commonly, such Overrides are references to other objects in the scene that cannot be referenced from the Prefab Asset. Overrides that are not typically applicable are now highlighted by a dark blue bar in the Inspector. These cannot be applied; only reverted.You can now change the default behavior when opening Prefab Mode to In Isolation instead of In Context. Go to Editor Preferences > General > Default Prefab Mode to make this change.Now, with 2022.2, Undo is recorded as a single Undo operation when exiting Prefab Mode. This results in all changes made to the Prefab being reverted if you perform an Undo after leaving Prefab Mode.Over the course of multiple releases, the error handling and reporting during scene loadhas substantially improved, and will now indicate which Prefabs the errors are related to and/or the GUID for missing Prefabs. In fact, the way we handle missing Prefabs’ assets during scene loading is safer and more stable than before.In an effort to further improve error handling and avoid introducing bad data into your project, we’ve added a Broken Prefab Asset Type, which will be produced by the Prefab Importer when errors that cannot be rectified are encountered.The most common case is when a Prefab Variant has lost its parent Prefab, perhaps because it was deleted. In this case, we can’t produce a meaningful Prefab Variant, so a Broken Prefab Asset is created instead. This new asset will show information about what is wrong in the Inspector when selected in the Project Browser. If it’s a case of a missing Prefab parent, then the GUID of the missing Prefab is shown. Alternatively, if it’s a chain of Prefab Variants that is broken, you can go up the chain through the Inspector until you find the Variant with the missing parent.The concept of Disconnected Prefab instances no longer exists as of 2022.1. We still support loading Disconnected Prefab instances, but when the Editor encounters them during scene loading, the Disconnected Prefab instances are stripped of all their Prefab information and become regular GameObjects.As mentioned, our team has fixed a series of bugs you’ve graciously reported to us over time. Some of them derive from the original Prefab system, but many have only become apparent upon the introduction of our improved Prefabs.Today, we are confident you will enjoy the stability of the latest Prefab system. We hope you will find it smooth and efficient to work with.Have more Prefab-related questions or comments? Join us in the forums to share your feedback. #whats #new #prefabs
    UNITY.COM
    What’s new for Prefabs in 2022.2?
    It’s been a while since the Scene Management team has shared an update on Prefabs. During the last few releases, and after fixing a large number of bugs you’ve reported (thank you!), we’ve made several improvements to the Prefab system. Let’s take a look at each improvement coming in 2022.2 – now available in beta – and how these updates can benefit you.You can now replace the Prefab Asset for a Prefab instance that exists either in a scene or nested inside other Prefabs. This feature will keep the Prefab instance position, rotation, and scale in the scene, but merge the contents from the new Prefab Asset, all while retaining as many overrides and references as possible via name-based matching (by default). More specifically:The Inspector for a Prefab instance has a new Object Field that can be used for replacing the Prefab Asset.The Hierarchy has Context Menus that can similarly replace the Prefab Asset of the instance.Finally, a plain GameObject can be converted to a Prefab instance through the Context Menu in the Hierarchy, or by dragging and dropping with the Ctrl/Cmd modifier key.This functionality is not only available in the UI, but as with most features we build, it has an API that allows you to manage how objects are matched, as well as how Overrides should be treated. See PrefabUtility.ReplacePrefabAssetOfPrefabInstanceand PrefabUtility.ConvertToPrefabInstance.One of the most requested improvements has been the ability to reorder added GameObjects and components. “Added GameObjects and components” refers to the GameObjects and components that are not part of a Prefab instance, but are added to the Prefab instance in a scene or inside a Variant or Nested Prefab. So as of 2022.1, it is possible to reorder the added GameObjects by drag and drop – both among themselves and between GameObjects belonging to the Prefab instance. Getting this feature ready has required a major refactoring of the Undo system.If you want to reorder added GameObjects from an Editor script, it is simply a matter of setting the sibling index on the Transform of the added GameObject. The ability to reorder added components in the Inspector is included in 2022.2. There is no public API for reordering components.The last thing we needed to achieve full feature parity between GameObjects and components was the ability to delete GameObjects from Prefab instances as an Override. Deleting GameObjects as Overrides, an option available in 2022.2, ensures that once you’ve deleted a GameObject, the usual workflows for reverting from/applying to a Prefab Asset works as you’d expect.When it comes to an Editor script, use Object.DestroyImmediate to destroy Prefab instance objects and record the destruction as an Override stored in the scene file.Users often ask what the Variant inheritance tree looks like for a specific Prefab Asset. In 2022.2, we added the Prefab Family pop-up to the Inspector. The content of the pop-up is dependent on the selected Prefab Asset in the Project Browser. After selecting a Prefab Asset and opening the Prefab Family pop-up, the Editor lists all the ancestors of the current Prefab, as well as all the immediate children.In addition to queries about the inheritance tree, users have often asked how they can get rid of unused Overrides stored in a scene but never accessed (because the property has been removed from a script). In the worst case, such properties might reference assets that are then pulled into the final build, taking up space on the storage device and in memory – but never used.Overrides are now flagged as unused for:Null target objectsUnknown Property Paths (which are not subject to scripted FormerlySerializedAsAttribute usage)Removed componentsRemoved GameObjectsChanged array dimensions (e.g., materials array)When selecting one or more Prefab instances in the Hierarchy and opening the Overrides drop-down, the Editor now shows whether there are unused Overrides. You can then remove them from the scene using the new Unused Overrides drop-down.Moreover, you can remove all unused Overrides in a scene through the Hierarchy’s Scene Context Menu or via the Context Menu for an arbitrary selection of Prefab instances.We do not automatically remove unused Overrides. After all, the reason for their existence cannot be inferred. Removing a property from a script or deleting an asset should not automatically remove unused Overrides as you might subsequently wish to undo the removal and have the Overrides restored.In case you’re wondering: “Why do I still have Overrides on my Prefab instance after pressing ‘Apply All’?” The answer is that those Overrides simply can’t be applied to the Prefab Asset. Most commonly, such Overrides are references to other objects in the scene that cannot be referenced from the Prefab Asset. Overrides that are not typically applicable are now highlighted by a dark blue bar in the Inspector. These cannot be applied; only reverted.You can now change the default behavior when opening Prefab Mode to In Isolation instead of In Context. Go to Editor Preferences > General > Default Prefab Mode to make this change.Now, with 2022.2, Undo is recorded as a single Undo operation when exiting Prefab Mode. This results in all changes made to the Prefab being reverted if you perform an Undo after leaving Prefab Mode.Over the course of multiple releases, the error handling and reporting during scene load (and Prefab load in Prefab Mode) has substantially improved, and will now indicate which Prefabs the errors are related to and/or the GUID for missing Prefabs. In fact, the way we handle missing Prefabs’ assets during scene loading is safer and more stable than before.In an effort to further improve error handling and avoid introducing bad data into your project, we’ve added a Broken Prefab Asset Type, which will be produced by the Prefab Importer when errors that cannot be rectified are encountered.The most common case is when a Prefab Variant has lost its parent Prefab, perhaps because it was deleted. In this case, we can’t produce a meaningful Prefab Variant, so a Broken Prefab Asset is created instead. This new asset will show information about what is wrong in the Inspector when selected in the Project Browser. If it’s a case of a missing Prefab parent, then the GUID of the missing Prefab is shown. Alternatively, if it’s a chain of Prefab Variants that is broken, you can go up the chain through the Inspector until you find the Variant with the missing parent.The concept of Disconnected Prefab instances no longer exists as of 2022.1. We still support loading Disconnected Prefab instances, but when the Editor encounters them during scene loading, the Disconnected Prefab instances are stripped of all their Prefab information and become regular GameObjects.As mentioned, our team has fixed a series of bugs you’ve graciously reported to us over time. Some of them derive from the original Prefab system, but many have only become apparent upon the introduction of our improved Prefabs.Today, we are confident you will enjoy the stability of the latest Prefab system. We hope you will find it smooth and efficient to work with.Have more Prefab-related questions or comments? Join us in the forums to share your feedback.
    0 Kommentare 0 Anteile
  • Unity 2022.2 Tech Stream is now available

    I’m delighted to share that the 2022.2 Tech Stream, our final release of the year, is available for download.Tech Stream releases allow you to go hands-on with early access to the latest features. It’s also an opportunity to share your feedback on how we can build even better tools to power your creativity.Most recently at Unite, we gathered with our community of game developers to share some of these updates on topics like DOTS, rendering, multiplayer development, and XR, and we celebrated Made with Unity games like V Rising, Pentiment, Breachers, and many more. The dialogue online from over 9,000 Discord messages and countless in-person conversations was invaluable to shaping the future of Unity.Coupled with the 1,470 new forum threads where we discussed product feedback with you since the 2022.1 Tech Stream arrived and the 3,080 new notes on the Unity Platform roadmap, this feedback helped us get to today’s release. We couldn’t have done it without you and are excited to get that work in your hands. To learn more about how your feedback drives product development, check out this blog post.Together with the first Tech Stream, today’s 2022.2 completes this year’s cycle. Join us and explore what’s in store ahead of the LTS release in 2023. For even more on where Unity is heading, I encourage you to read our Games Focus blog series.In this post, I’ll be sharing a few highlights from this release, but you can always get more details in the official release notes.A frequent request we receive is to give you the ability to create more engaging gaming experiences, deeply immersive worlds, and to do so with more objects and characters than ever before.Unity 2022.2 includesECS for Unity, a data-oriented framework that empowers you to build more ambitious games with an unprecedented level of control and determinism. ECS and a data-oriented approach to development put complex gameplay mechanics and rich, dynamic environments at your fingertips. Starting with Unity 2022.2, ECS for Unity is fully supported for production, so you can get even more out of ECS through support channels and success plans.ECS for Unity includes the Entities package, along with ECS-compatible packages for Netcode, Graphics, and Physics. If you’re already familiar with Unity’s GameObject architecture and scripting standards, ECS for Unity is fully compatible with GameObjects, so you’ll find a familiar authoring experience and streamlined workflows. This gives you the capability to leverage your existing skill set and leverage ECS only where it will best benefit your game experience.We’re already seeing some great games running on ECS for Unity, such as Stunlock Studios’s V Rising. Because they turned to ECS, they were able to vastly increase the number of in-game interactable assets to more than 160,000 across a 5km2 map, with more than 350,000 server-side entities powering the experience.If you’re looking for help, want to provide feedback, discuss best practices, or show off your projects, you can join a thriving community on our forums and Discord. Our teams regularly engage in these channels and keep a close eye on your feedback. Join us on December 8, 2022 for our Dev Blitz Day dedicated to DOTS, when we’ll be spending an entire day trying to answer all your ECS questions.The last 18 months have seen an explosion of multiplayer experiences being built with Unity, and we hear that many of you want to add multiplayer access to your games but aren’t sure where to start.Alongside Unity 2022.2, we’re highlighting Netcode for GameObjects, a package that simplifies the implementation of multiplayer capability to your project in a number of scenarios such as couch cooperative play. The package works with familiar GameObject-based programming techniques, and it abstracts away low-level functionality so you can write less code while creating the multiplayer experience you envision.For more demanding, large-scale games, you can harness the power of ECS with Netcode for Entities. Netcode for Entities can enable you to increase your game world size, player counts, and complex network interactions without the performance sacrifices developers have traditionally had to deal with.We also recently announced the launch of self-serve capabilities in our Multiplayer Solutions suite within Unity Gaming Services, which helps you to operate your multiplayer games with hosting, communications, and more. Learn more about the latest developments for this tech in this Games Focus blog, or take a deeper look at the UGS Multiplayer suite in this UGS video, produced in collaboration with Tarodev.Multiplatform scalability and high-fidelity graphics continue to be our focus for rendering. In our Games Focus blog “Rendering that scales with your needs,” we covered our dedication to delivering features that allow you to scale with confidence while tapping into an even broader range of tools that provides the best possible visual quality and performance.We continue to bring the Universal Render Pipelinecloser to feature parity with Built-in Render Pipeline through more streamlined and scalable workflows. We worked on key tools such asForward+, which provides functional parity with Forward path in Built-in Render Pipeline, eliminating the light limit count so you can scale with quality across platforms.Another key feature is Decal Layers,which allow you to filter and configure how different objects are affected by Decal Projectors in a scene. Decals are useful for adding extra texture details to a scene, especially to break the repetitiveness of materials and their detail patterns.Other special URP enhancements include LOD crossfade for smoother transitions and Built-in Converter improvements that provide you with tools to upgrade your existing projects from the Built-in Render Pipeline to URP. You can also personalize your rendering experience with Shader Graph Full Screen Master Node and Custom Post Processing across both renderers.Diving into High Definition Render Pipeline, we’ve made enhancements that help you create even more beautiful physically based environments and detailed characters. You can scale high-fidelity environments with the new HDRP Water System to render oceans, rivers, and underwater effects, and use Volumetric Material to create procedural local fog using Shader Graph. Create even more realistic skies with improved Cloud Layers dynamic lighting, and you can even blend between different Volumetric Cloud conditions.You can also take your cinematic renders further to render realistic characters with Eye Cinematic with Caustics and PCSS shadows. HDRP Path Tracing Denoising provides you the choice between NVIDIA Optix™ AI accelerated denoiser and Intel® Open Image.Watch our latest Unite 2022 session on Lighting Environments in Unity to discover some key tips to get you started with our latest HDRP environment tools.Creative endeavors are never linear, and we understand that rapid iteration is part of the journey. This release includes new authoring features and workflow improvements to help speed up your productivity.For example, the Prefab system sees a number of upgrades, including the ability to quickly replace a Prefab Asset for a Prefab instance in a scene or nested inside other Prefabs. Read our latest blog on this topic for more information.For faster environments, the Paint Detail brush in the Terrain Tools package now allows you to simultaneously scatter multiple types of details with per-detail-type density settings available. Additionally, detail density and a few other Terrain settings are now overridable in the Quality settings to help you achieve platform performance targets.You can also use improved tooling and API features for Splines to help draw paths in your environments with greater precision. This means you can build out rivers, roads, camera tracks, and other path-related features and tools more efficiently. Thank you to all who engaged with us in the worldbuilding forums in the last couple months to help us finalize this delivery. For more on the API features, check out the documentation.Finally, the AI Navigation package is now available for you to quickly add intelligence to 3D characters and move in game worlds without needing to code rules manually. It also ships with samples to help you get started. See the forum for more details, and check out what’s next on the roadmap.In 2022.2, UI Toolkit is reaching parity with IMGUI for customizing the Editor and is the recommended solution for Editor tools. This means better separation of concerns, more flexible layouts, and advanced stylings. With updates like default inspectors generated with UI Toolkit, ported common built-in Property Drawers, TreeView controls with multicolumn support, and a new vector-drawing API, this release not only helps us reach parity with IMGUI but also supports runtime use cases as well.If you want to learn more about the current state of runtime, we recently released a new project demonstrating a full-feature interface with UI Toolkit based on your feedback for more samples. Check that out here.To help you get started, watch the recent Unite session illustrating a step-by-step example of how to build custom tools with UI Toolkit. Plus, visit the recently released Editor Design system for guidance on how to build intuitive experiences.After extensive work, testing, and listening to a lot of community feedback, DirectX 12 is out of an experimental state with the release of 2022.2. Depending on the project, you can now expect performance on par or greater than DX11, especially in draw call-heavy scenes.This is a result of significant investment into performance and stability, making DX12 the recommended graphics API for Windows and Xbox development. Additionally, DX12 lays the foundation for more advanced graphics features, such as real-time ray tracing, which is now available for Xbox game development. We couldn’t be more excited and thankful to you all for helping us get DX12 across the finish line and look forward to the great games you’ll be creating.We continue to hear that you not only want us to support new platforms, but also where we can simplify and improve development when targeting devices. If you haven’t already, check out the Games Focus blog “Reach more players over multiple platforms and form factors,” where we dive into both what is here now and what will be available in the near future.We’re making cross-device XR creation simpler with Unity XR Interaction toolkit. XRI provides a framework for common interactions that work across various controllers, such as grab, hover, select, visual feedback to indicate possible interactions on objects, and more. XRI is now in version 2.2, which adds multi-grab support, new locomotion methods, and a collection of ready-to-go Prefabs in our Starter Assets sample package.We recently invited the creators of Blacktop Hoops, a VR basketball game, to talk about how they used XRI as the base for their input controls during the Unite 2022 Keynote. Check out the XR segment for more information.We’ve also updated AR Foundation to version 5.0. This update brings two key features to reduce development time. The first is simulation, allowing you to test your AR app in the Editor using Play mode, an update that addresses a common AR developer frustration in the past. We’ve also added the AR Debug Menu as a new Prefab that you can use to view available configurations on your device and visualize AR subsystem data such as planes and point cloud positions.Finally, we’re continuing to add key platform support to the Editor with Meta Quest Pro, PlayStation®VR2 and Magic Leap 2.To read more about the 2022.2 Tech Stream, check out the release notes for a comprehensive list of features and the Unity Manual for documentation. As you dive in, keep in mind that while each Tech Stream release is supported with weekly updates until the next one, there is no guarantee for long-term support for new features and remember to always back up your work prior to upgrading to a new version. The upgrade guide can also assist with this. For projects in production, we recommend using Unity Long Term Release for stability and support.Each Tech Stream is an opportunity to not only get early access to new features, but also to shape the development of future tech through your feedback. We want to hear how we can best serve you and your projects. Let us know how we’re doing on the forums, or share feedback directly with our product team through the Unity Platform Roadmap. You can also follow us on Twitter and catch our latest Unity Twitch Roundtable, covering 2022.2, on demand.This release completes our 2022 development cycle. We have ambitious goals for next year, which you can read about in our Games Focus series or watch in the recent Unite Roadmap session. Thank you for all your support, and we look forward to partnering with you every step of the way.
    #unity #tech #stream #now #available
    Unity 2022.2 Tech Stream is now available
    I’m delighted to share that the 2022.2 Tech Stream, our final release of the year, is available for download.Tech Stream releases allow you to go hands-on with early access to the latest features. It’s also an opportunity to share your feedback on how we can build even better tools to power your creativity.Most recently at Unite, we gathered with our community of game developers to share some of these updates on topics like DOTS, rendering, multiplayer development, and XR, and we celebrated Made with Unity games like V Rising, Pentiment, Breachers, and many more. The dialogue online from over 9,000 Discord messages and countless in-person conversations was invaluable to shaping the future of Unity.Coupled with the 1,470 new forum threads where we discussed product feedback with you since the 2022.1 Tech Stream arrived and the 3,080 new notes on the Unity Platform roadmap, this feedback helped us get to today’s release. We couldn’t have done it without you and are excited to get that work in your hands. To learn more about how your feedback drives product development, check out this blog post.Together with the first Tech Stream, today’s 2022.2 completes this year’s cycle. Join us and explore what’s in store ahead of the LTS release in 2023. For even more on where Unity is heading, I encourage you to read our Games Focus blog series.In this post, I’ll be sharing a few highlights from this release, but you can always get more details in the official release notes.A frequent request we receive is to give you the ability to create more engaging gaming experiences, deeply immersive worlds, and to do so with more objects and characters than ever before.Unity 2022.2 includesECS for Unity, a data-oriented framework that empowers you to build more ambitious games with an unprecedented level of control and determinism. ECS and a data-oriented approach to development put complex gameplay mechanics and rich, dynamic environments at your fingertips. Starting with Unity 2022.2, ECS for Unity is fully supported for production, so you can get even more out of ECS through support channels and success plans.ECS for Unity includes the Entities package, along with ECS-compatible packages for Netcode, Graphics, and Physics. If you’re already familiar with Unity’s GameObject architecture and scripting standards, ECS for Unity is fully compatible with GameObjects, so you’ll find a familiar authoring experience and streamlined workflows. This gives you the capability to leverage your existing skill set and leverage ECS only where it will best benefit your game experience.We’re already seeing some great games running on ECS for Unity, such as Stunlock Studios’s V Rising. Because they turned to ECS, they were able to vastly increase the number of in-game interactable assets to more than 160,000 across a 5km2 map, with more than 350,000 server-side entities powering the experience.If you’re looking for help, want to provide feedback, discuss best practices, or show off your projects, you can join a thriving community on our forums and Discord. Our teams regularly engage in these channels and keep a close eye on your feedback. Join us on December 8, 2022 for our Dev Blitz Day dedicated to DOTS, when we’ll be spending an entire day trying to answer all your ECS questions.The last 18 months have seen an explosion of multiplayer experiences being built with Unity, and we hear that many of you want to add multiplayer access to your games but aren’t sure where to start.Alongside Unity 2022.2, we’re highlighting Netcode for GameObjects, a package that simplifies the implementation of multiplayer capability to your project in a number of scenarios such as couch cooperative play. The package works with familiar GameObject-based programming techniques, and it abstracts away low-level functionality so you can write less code while creating the multiplayer experience you envision.For more demanding, large-scale games, you can harness the power of ECS with Netcode for Entities. Netcode for Entities can enable you to increase your game world size, player counts, and complex network interactions without the performance sacrifices developers have traditionally had to deal with.We also recently announced the launch of self-serve capabilities in our Multiplayer Solutions suite within Unity Gaming Services, which helps you to operate your multiplayer games with hosting, communications, and more. Learn more about the latest developments for this tech in this Games Focus blog, or take a deeper look at the UGS Multiplayer suite in this UGS video, produced in collaboration with Tarodev.Multiplatform scalability and high-fidelity graphics continue to be our focus for rendering. In our Games Focus blog “Rendering that scales with your needs,” we covered our dedication to delivering features that allow you to scale with confidence while tapping into an even broader range of tools that provides the best possible visual quality and performance.We continue to bring the Universal Render Pipelinecloser to feature parity with Built-in Render Pipeline through more streamlined and scalable workflows. We worked on key tools such asForward+, which provides functional parity with Forward path in Built-in Render Pipeline, eliminating the light limit count so you can scale with quality across platforms.Another key feature is Decal Layers,which allow you to filter and configure how different objects are affected by Decal Projectors in a scene. Decals are useful for adding extra texture details to a scene, especially to break the repetitiveness of materials and their detail patterns.Other special URP enhancements include LOD crossfade for smoother transitions and Built-in Converter improvements that provide you with tools to upgrade your existing projects from the Built-in Render Pipeline to URP. You can also personalize your rendering experience with Shader Graph Full Screen Master Node and Custom Post Processing across both renderers.Diving into High Definition Render Pipeline, we’ve made enhancements that help you create even more beautiful physically based environments and detailed characters. You can scale high-fidelity environments with the new HDRP Water System to render oceans, rivers, and underwater effects, and use Volumetric Material to create procedural local fog using Shader Graph. Create even more realistic skies with improved Cloud Layers dynamic lighting, and you can even blend between different Volumetric Cloud conditions.You can also take your cinematic renders further to render realistic characters with Eye Cinematic with Caustics and PCSS shadows. HDRP Path Tracing Denoising provides you the choice between NVIDIA Optix™ AI accelerated denoiser and Intel® Open Image.Watch our latest Unite 2022 session on Lighting Environments in Unity to discover some key tips to get you started with our latest HDRP environment tools.Creative endeavors are never linear, and we understand that rapid iteration is part of the journey. This release includes new authoring features and workflow improvements to help speed up your productivity.For example, the Prefab system sees a number of upgrades, including the ability to quickly replace a Prefab Asset for a Prefab instance in a scene or nested inside other Prefabs. Read our latest blog on this topic for more information.For faster environments, the Paint Detail brush in the Terrain Tools package now allows you to simultaneously scatter multiple types of details with per-detail-type density settings available. Additionally, detail density and a few other Terrain settings are now overridable in the Quality settings to help you achieve platform performance targets.You can also use improved tooling and API features for Splines to help draw paths in your environments with greater precision. This means you can build out rivers, roads, camera tracks, and other path-related features and tools more efficiently. Thank you to all who engaged with us in the worldbuilding forums in the last couple months to help us finalize this delivery. For more on the API features, check out the documentation.Finally, the AI Navigation package is now available for you to quickly add intelligence to 3D characters and move in game worlds without needing to code rules manually. It also ships with samples to help you get started. See the forum for more details, and check out what’s next on the roadmap.In 2022.2, UI Toolkit is reaching parity with IMGUI for customizing the Editor and is the recommended solution for Editor tools. This means better separation of concerns, more flexible layouts, and advanced stylings. With updates like default inspectors generated with UI Toolkit, ported common built-in Property Drawers, TreeView controls with multicolumn support, and a new vector-drawing API, this release not only helps us reach parity with IMGUI but also supports runtime use cases as well.If you want to learn more about the current state of runtime, we recently released a new project demonstrating a full-feature interface with UI Toolkit based on your feedback for more samples. Check that out here.To help you get started, watch the recent Unite session illustrating a step-by-step example of how to build custom tools with UI Toolkit. Plus, visit the recently released Editor Design system for guidance on how to build intuitive experiences.After extensive work, testing, and listening to a lot of community feedback, DirectX 12 is out of an experimental state with the release of 2022.2. Depending on the project, you can now expect performance on par or greater than DX11, especially in draw call-heavy scenes.This is a result of significant investment into performance and stability, making DX12 the recommended graphics API for Windows and Xbox development. Additionally, DX12 lays the foundation for more advanced graphics features, such as real-time ray tracing, which is now available for Xbox game development. We couldn’t be more excited and thankful to you all for helping us get DX12 across the finish line and look forward to the great games you’ll be creating.We continue to hear that you not only want us to support new platforms, but also where we can simplify and improve development when targeting devices. If you haven’t already, check out the Games Focus blog “Reach more players over multiple platforms and form factors,” where we dive into both what is here now and what will be available in the near future.We’re making cross-device XR creation simpler with Unity XR Interaction toolkit. XRI provides a framework for common interactions that work across various controllers, such as grab, hover, select, visual feedback to indicate possible interactions on objects, and more. XRI is now in version 2.2, which adds multi-grab support, new locomotion methods, and a collection of ready-to-go Prefabs in our Starter Assets sample package.We recently invited the creators of Blacktop Hoops, a VR basketball game, to talk about how they used XRI as the base for their input controls during the Unite 2022 Keynote. Check out the XR segment for more information.We’ve also updated AR Foundation to version 5.0. This update brings two key features to reduce development time. The first is simulation, allowing you to test your AR app in the Editor using Play mode, an update that addresses a common AR developer frustration in the past. We’ve also added the AR Debug Menu as a new Prefab that you can use to view available configurations on your device and visualize AR subsystem data such as planes and point cloud positions.Finally, we’re continuing to add key platform support to the Editor with Meta Quest Pro, PlayStation®VR2 and Magic Leap 2.To read more about the 2022.2 Tech Stream, check out the release notes for a comprehensive list of features and the Unity Manual for documentation. As you dive in, keep in mind that while each Tech Stream release is supported with weekly updates until the next one, there is no guarantee for long-term support for new features and remember to always back up your work prior to upgrading to a new version. The upgrade guide can also assist with this. For projects in production, we recommend using Unity Long Term Release for stability and support.Each Tech Stream is an opportunity to not only get early access to new features, but also to shape the development of future tech through your feedback. We want to hear how we can best serve you and your projects. Let us know how we’re doing on the forums, or share feedback directly with our product team through the Unity Platform Roadmap. You can also follow us on Twitter and catch our latest Unity Twitch Roundtable, covering 2022.2, on demand.This release completes our 2022 development cycle. We have ambitious goals for next year, which you can read about in our Games Focus series or watch in the recent Unite Roadmap session. Thank you for all your support, and we look forward to partnering with you every step of the way. #unity #tech #stream #now #available
    UNITY.COM
    Unity 2022.2 Tech Stream is now available
    I’m delighted to share that the 2022.2 Tech Stream, our final release of the year, is available for download.Tech Stream releases allow you to go hands-on with early access to the latest features. It’s also an opportunity to share your feedback on how we can build even better tools to power your creativity.Most recently at Unite, we gathered with our community of game developers to share some of these updates on topics like DOTS, rendering, multiplayer development, and XR, and we celebrated Made with Unity games like V Rising, Pentiment, Breachers, and many more. The dialogue online from over 9,000 Discord messages and countless in-person conversations was invaluable to shaping the future of Unity.Coupled with the 1,470 new forum threads where we discussed product feedback with you since the 2022.1 Tech Stream arrived and the 3,080 new notes on the Unity Platform roadmap, this feedback helped us get to today’s release. We couldn’t have done it without you and are excited to get that work in your hands. To learn more about how your feedback drives product development, check out this blog post.Together with the first Tech Stream, today’s 2022.2 completes this year’s cycle. Join us and explore what’s in store ahead of the LTS release in 2023. For even more on where Unity is heading, I encourage you to read our Games Focus blog series.In this post, I’ll be sharing a few highlights from this release, but you can always get more details in the official release notes.A frequent request we receive is to give you the ability to create more engaging gaming experiences, deeply immersive worlds, and to do so with more objects and characters than ever before.Unity 2022.2 includesECS for Unity (Entity Component System), a data-oriented framework that empowers you to build more ambitious games with an unprecedented level of control and determinism. ECS and a data-oriented approach to development put complex gameplay mechanics and rich, dynamic environments at your fingertips. Starting with Unity 2022.2, ECS for Unity is fully supported for production, so you can get even more out of ECS through support channels and success plans.ECS for Unity includes the Entities package, along with ECS-compatible packages for Netcode, Graphics, and Physics. If you’re already familiar with Unity’s GameObject architecture and scripting standards, ECS for Unity is fully compatible with GameObjects, so you’ll find a familiar authoring experience and streamlined workflows. This gives you the capability to leverage your existing skill set and leverage ECS only where it will best benefit your game experience.We’re already seeing some great games running on ECS for Unity, such as Stunlock Studios’s V Rising. Because they turned to ECS, they were able to vastly increase the number of in-game interactable assets to more than 160,000 across a 5km2 map, with more than 350,000 server-side entities powering the experience.If you’re looking for help, want to provide feedback, discuss best practices, or show off your projects, you can join a thriving community on our forums and Discord. Our teams regularly engage in these channels and keep a close eye on your feedback. Join us on December 8, 2022 for our Dev Blitz Day dedicated to DOTS, when we’ll be spending an entire day trying to answer all your ECS questions.The last 18 months have seen an explosion of multiplayer experiences being built with Unity, and we hear that many of you want to add multiplayer access to your games but aren’t sure where to start.Alongside Unity 2022.2, we’re highlighting Netcode for GameObjects, a package that simplifies the implementation of multiplayer capability to your project in a number of scenarios such as couch cooperative play. The package works with familiar GameObject-based programming techniques, and it abstracts away low-level functionality so you can write less code while creating the multiplayer experience you envision.For more demanding, large-scale games, you can harness the power of ECS with Netcode for Entities. Netcode for Entities can enable you to increase your game world size, player counts, and complex network interactions without the performance sacrifices developers have traditionally had to deal with.We also recently announced the launch of self-serve capabilities in our Multiplayer Solutions suite within Unity Gaming Services (UGS), which helps you to operate your multiplayer games with hosting, communications, and more. Learn more about the latest developments for this tech in this Games Focus blog, or take a deeper look at the UGS Multiplayer suite in this UGS video, produced in collaboration with Tarodev.Multiplatform scalability and high-fidelity graphics continue to be our focus for rendering. In our Games Focus blog “Rendering that scales with your needs,” we covered our dedication to delivering features that allow you to scale with confidence while tapping into an even broader range of tools that provides the best possible visual quality and performance.We continue to bring the Universal Render Pipeline (URP) closer to feature parity with Built-in Render Pipeline through more streamlined and scalable workflows. We worked on key tools such asForward+, which provides functional parity with Forward path in Built-in Render Pipeline, eliminating the light limit count so you can scale with quality across platforms.Another key feature is Decal Layers,which allow you to filter and configure how different objects are affected by Decal Projectors in a scene. Decals are useful for adding extra texture details to a scene, especially to break the repetitiveness of materials and their detail patterns.Other special URP enhancements include LOD crossfade for smoother transitions and Built-in Converter improvements that provide you with tools to upgrade your existing projects from the Built-in Render Pipeline to URP. You can also personalize your rendering experience with Shader Graph Full Screen Master Node and Custom Post Processing across both renderers.Diving into High Definition Render Pipeline (HDRP), we’ve made enhancements that help you create even more beautiful physically based environments and detailed characters. You can scale high-fidelity environments with the new HDRP Water System to render oceans, rivers, and underwater effects, and use Volumetric Material to create procedural local fog using Shader Graph. Create even more realistic skies with improved Cloud Layers dynamic lighting, and you can even blend between different Volumetric Cloud conditions.You can also take your cinematic renders further to render realistic characters with Eye Cinematic with Caustics and PCSS shadows. HDRP Path Tracing Denoising provides you the choice between NVIDIA Optix™ AI accelerated denoiser and Intel® Open Image.Watch our latest Unite 2022 session on Lighting Environments in Unity to discover some key tips to get you started with our latest HDRP environment tools.Creative endeavors are never linear, and we understand that rapid iteration is part of the journey. This release includes new authoring features and workflow improvements to help speed up your productivity.For example, the Prefab system sees a number of upgrades, including the ability to quickly replace a Prefab Asset for a Prefab instance in a scene or nested inside other Prefabs. Read our latest blog on this topic for more information.For faster environments, the Paint Detail brush in the Terrain Tools package now allows you to simultaneously scatter multiple types of details with per-detail-type density settings available. Additionally, detail density and a few other Terrain settings are now overridable in the Quality settings to help you achieve platform performance targets.You can also use improved tooling and API features for Splines to help draw paths in your environments with greater precision. This means you can build out rivers, roads, camera tracks, and other path-related features and tools more efficiently. Thank you to all who engaged with us in the worldbuilding forums in the last couple months to help us finalize this delivery. For more on the API features, check out the documentation.Finally, the AI Navigation package is now available for you to quickly add intelligence to 3D characters and move in game worlds without needing to code rules manually. It also ships with samples to help you get started. See the forum for more details, and check out what’s next on the roadmap.In 2022.2, UI Toolkit is reaching parity with IMGUI for customizing the Editor and is the recommended solution for Editor tools. This means better separation of concerns, more flexible layouts, and advanced stylings. With updates like default inspectors generated with UI Toolkit, ported common built-in Property Drawers, TreeView controls with multicolumn support, and a new vector-drawing API, this release not only helps us reach parity with IMGUI but also supports runtime use cases as well.If you want to learn more about the current state of runtime, we recently released a new project demonstrating a full-feature interface with UI Toolkit based on your feedback for more samples. Check that out here.To help you get started, watch the recent Unite session illustrating a step-by-step example of how to build custom tools with UI Toolkit. Plus, visit the recently released Editor Design system for guidance on how to build intuitive experiences.After extensive work, testing, and listening to a lot of community feedback, DirectX 12 is out of an experimental state with the release of 2022.2. Depending on the project, you can now expect performance on par or greater than DX11, especially in draw call-heavy scenes.This is a result of significant investment into performance and stability, making DX12 the recommended graphics API for Windows and Xbox development. Additionally, DX12 lays the foundation for more advanced graphics features, such as real-time ray tracing, which is now available for Xbox game development. We couldn’t be more excited and thankful to you all for helping us get DX12 across the finish line and look forward to the great games you’ll be creating.We continue to hear that you not only want us to support new platforms, but also where we can simplify and improve development when targeting devices. If you haven’t already, check out the Games Focus blog “Reach more players over multiple platforms and form factors,” where we dive into both what is here now and what will be available in the near future.We’re making cross-device XR creation simpler with Unity XR Interaction toolkit (XRI). XRI provides a framework for common interactions that work across various controllers, such as grab, hover, select, visual feedback to indicate possible interactions on objects, and more. XRI is now in version 2.2, which adds multi-grab support, new locomotion methods, and a collection of ready-to-go Prefabs in our Starter Assets sample package.We recently invited the creators of Blacktop Hoops, a VR basketball game, to talk about how they used XRI as the base for their input controls during the Unite 2022 Keynote. Check out the XR segment for more information.We’ve also updated AR Foundation to version 5.0. This update brings two key features to reduce development time. The first is simulation, allowing you to test your AR app in the Editor using Play mode, an update that addresses a common AR developer frustration in the past. We’ve also added the AR Debug Menu as a new Prefab that you can use to view available configurations on your device and visualize AR subsystem data such as planes and point cloud positions.Finally, we’re continuing to add key platform support to the Editor with Meta Quest Pro, PlayStation®VR2 and Magic Leap 2.To read more about the 2022.2 Tech Stream, check out the release notes for a comprehensive list of features and the Unity Manual for documentation. As you dive in, keep in mind that while each Tech Stream release is supported with weekly updates until the next one, there is no guarantee for long-term support for new features and remember to always back up your work prior to upgrading to a new version. The upgrade guide can also assist with this. For projects in production, we recommend using Unity Long Term Release for stability and support.Each Tech Stream is an opportunity to not only get early access to new features, but also to shape the development of future tech through your feedback. We want to hear how we can best serve you and your projects. Let us know how we’re doing on the forums, or share feedback directly with our product team through the Unity Platform Roadmap. You can also follow us on Twitter and catch our latest Unity Twitch Roundtable, covering 2022.2, on demand.This release completes our 2022 development cycle. We have ambitious goals for next year, which you can read about in our Games Focus series or watch in the recent Unite Roadmap session. Thank you for all your support, and we look forward to partnering with you every step of the way.
    0 Kommentare 0 Anteile
  • It’s all in here: The ultimate guide to creating UI interfaces in Unity

    Thousands of people have preregistered and now it’s finally here: Our biggest e-book yet, User interface design and implementation in Unity, is available to download. Get ready to dive into over 130 pages of advanced instruction in UI design.Your game’s user interface is perhaps the most direct way you can communicate with and guide your players – like a folded map you hand to them that reveals clues, key details, and directions as they progress. Whether you’re using more traditional elements like health bars and pop-up messages, or elements completely embedded in the game world, such as showing stats on the back of a player’s survival suit, the UI is integral to immersing players in your game’s story, realm, and artistic style.We’re thrilled to announce that our latest technical e-book, User interface design and implementation in Unity, is available to download for free. Thousands of people have already signed up for it, and just as many have downloaded its companion piece, the demo project, UI Toolkit sample – Dragon Crashers, to date. Now it’s your turn.The interest in this e-book is understandable. As it says in the introduction, “User interface is a critical part of any game… a solid graphical user interfaceis an extension of a game’s visual identity…modern audiences crave refined, intuitive GUIs that seamlessly integrate with your application.”The guide begins by covering UI design and art creation fundamentals, and then moves on to in-depth instructional sections on UI development in Unity. Written and reviewed by technical and UI artists – external and Unity professionals alike – the e-book unpacks both Unity UI, the default solution, and the newer UI Toolkit.The emphasis, however, is on the latter toolset, as UI Toolkit now provides many benefits for projects with complex, fullscreen interfaces. Think of projects that require a scalable and performant system for runtime UI. To help you choose the right solution for your project, please refer to this section of the Unity manual.The e-book is a treasure trove of information for professional UI designers, artists, and other Unity creators who want to deepen their knowledge of UI development. Here’s a snapshot of what’s inside.The first section aims to inspire with foundational tips for making effective UI. It looks at examples of diegetic UIs, where UI elements can be found right in the story, making parts of the game world function as a user interface. It explains how elements can either contribute to or break the immersion that a player experiences. We even turned this section into a blog post that you can read here.The guide then turns to the roles and responsibilities of a UI designer, and what tools and methods they employ such as UI wireframing, art creation through mockups, fonts, and grey-boxing. There’s also a chapter on asset preparation and exporting graphics from Digital Content Creationtools. These earlier sections in the guide are helpful no matter what game engine and UI solution you’re using.An extensive chapter is devoted to Unity UI. Unity UI is our longtime system for creating in-game UIs, and currently the go-to solution for positioning UI in a 3D world or using GameObject-based Unity systems.This section outlines Unity UI fundamentals for prototyping and integrating assets in-Editor: the Canvas, prebuilt UI elements, TextMesh Pro, and Prefabs, among others. We recently updated an article on advanced optimization techniques for Unity UI, where you can find tips on related topics.UI Toolkit is made for maximum performance and reusability with workflows and authoring tools informed by standard web technologies. UI designers and artists will likely find it familiar, especially with prior experience designing web pages.Three major sections of the guide highlight instructions for developing runtime UI with UI Toolkit. There’s a thorough explanation of the parts that comprise UIs made with UI Toolkit, including the Unity Extensible Markup Languageand Unity Style Sheetusing UI Builder.You’ll explore how UI Toolkit positions visual elements based on Yoga, an HTML/CSS Layout engine that implements a subset of Flexbox. Flexbox architecture provides advantages, such as responsive UI, enabling you to adapt your UI to different screen resolutions and sizes. Through both UXML and USS, you can decouple the styles applied to UI layouts, while logic and functionality continue to live in code. Workflows for visual elements, the fundamental building blocks of each interface, are also discussed in great detail – from positioning, size, and alignment settings, to margins and padding.The chapter on styling shows you how to define reusable styling for visual elements with Selectors, override styles and define unique attributes with inline styles, and create animations and effects with USS animation and a Camera Render Texture. It also demonstrates how you can thematize UI elements for holidays and other special events.That’s when the e-book gets into UI Toolkit sample – Dragon Crashers, with different sections that depict how the UI was made; from the menus and custom controls like radial counters or tabbed views, to embedded UXML templates and more.Finally, the guide concludes with a mini profile of the studio Mechanistry’s UI migration to UI Toolkit for their new game, Timberborn. This brief study showcases how their lean team managed to scale and keep their game consistent across various menus and screens.At 137 pages, the UI e-book is not a light read. As with the other technical e-books released this past year, use it as a reference on an ongoing basis.Along with the e-book, check out a couple of recently released resources filled with useful tips for leveraging Unity UI and UI Toolkit:The Unite 2022 session, Extending the Unity Editor with custom tools using UI Toolkit, shows programmers how to use UI Builder to create a custom Inspector for real-time Play Mode debug data visualization.The webinar, Best practices for mobile UI design, gathers experts from Outfit7, Samsung, and Unity to share strategies for maximizing the creativity and flow of your mobile games.Bookmark one or both of these pages. They compile all of our technical e-books and advanced content:Unity best practicesAdvanced best practices – Unity ManualWe hope that you enjoy this latest e-book and look forward to your feedback in this forum.
    #its #all #here #ultimate #guide
    It’s all in here: The ultimate guide to creating UI interfaces in Unity
    Thousands of people have preregistered and now it’s finally here: Our biggest e-book yet, User interface design and implementation in Unity, is available to download. Get ready to dive into over 130 pages of advanced instruction in UI design.Your game’s user interface is perhaps the most direct way you can communicate with and guide your players – like a folded map you hand to them that reveals clues, key details, and directions as they progress. Whether you’re using more traditional elements like health bars and pop-up messages, or elements completely embedded in the game world, such as showing stats on the back of a player’s survival suit, the UI is integral to immersing players in your game’s story, realm, and artistic style.We’re thrilled to announce that our latest technical e-book, User interface design and implementation in Unity, is available to download for free. Thousands of people have already signed up for it, and just as many have downloaded its companion piece, the demo project, UI Toolkit sample – Dragon Crashers, to date. Now it’s your turn.The interest in this e-book is understandable. As it says in the introduction, “User interface is a critical part of any game… a solid graphical user interfaceis an extension of a game’s visual identity…modern audiences crave refined, intuitive GUIs that seamlessly integrate with your application.”The guide begins by covering UI design and art creation fundamentals, and then moves on to in-depth instructional sections on UI development in Unity. Written and reviewed by technical and UI artists – external and Unity professionals alike – the e-book unpacks both Unity UI, the default solution, and the newer UI Toolkit.The emphasis, however, is on the latter toolset, as UI Toolkit now provides many benefits for projects with complex, fullscreen interfaces. Think of projects that require a scalable and performant system for runtime UI. To help you choose the right solution for your project, please refer to this section of the Unity manual.The e-book is a treasure trove of information for professional UI designers, artists, and other Unity creators who want to deepen their knowledge of UI development. Here’s a snapshot of what’s inside.The first section aims to inspire with foundational tips for making effective UI. It looks at examples of diegetic UIs, where UI elements can be found right in the story, making parts of the game world function as a user interface. It explains how elements can either contribute to or break the immersion that a player experiences. We even turned this section into a blog post that you can read here.The guide then turns to the roles and responsibilities of a UI designer, and what tools and methods they employ such as UI wireframing, art creation through mockups, fonts, and grey-boxing. There’s also a chapter on asset preparation and exporting graphics from Digital Content Creationtools. These earlier sections in the guide are helpful no matter what game engine and UI solution you’re using.An extensive chapter is devoted to Unity UI. Unity UI is our longtime system for creating in-game UIs, and currently the go-to solution for positioning UI in a 3D world or using GameObject-based Unity systems.This section outlines Unity UI fundamentals for prototyping and integrating assets in-Editor: the Canvas, prebuilt UI elements, TextMesh Pro, and Prefabs, among others. We recently updated an article on advanced optimization techniques for Unity UI, where you can find tips on related topics.UI Toolkit is made for maximum performance and reusability with workflows and authoring tools informed by standard web technologies. UI designers and artists will likely find it familiar, especially with prior experience designing web pages.Three major sections of the guide highlight instructions for developing runtime UI with UI Toolkit. There’s a thorough explanation of the parts that comprise UIs made with UI Toolkit, including the Unity Extensible Markup Languageand Unity Style Sheetusing UI Builder.You’ll explore how UI Toolkit positions visual elements based on Yoga, an HTML/CSS Layout engine that implements a subset of Flexbox. Flexbox architecture provides advantages, such as responsive UI, enabling you to adapt your UI to different screen resolutions and sizes. Through both UXML and USS, you can decouple the styles applied to UI layouts, while logic and functionality continue to live in code. Workflows for visual elements, the fundamental building blocks of each interface, are also discussed in great detail – from positioning, size, and alignment settings, to margins and padding.The chapter on styling shows you how to define reusable styling for visual elements with Selectors, override styles and define unique attributes with inline styles, and create animations and effects with USS animation and a Camera Render Texture. It also demonstrates how you can thematize UI elements for holidays and other special events.That’s when the e-book gets into UI Toolkit sample – Dragon Crashers, with different sections that depict how the UI was made; from the menus and custom controls like radial counters or tabbed views, to embedded UXML templates and more.Finally, the guide concludes with a mini profile of the studio Mechanistry’s UI migration to UI Toolkit for their new game, Timberborn. This brief study showcases how their lean team managed to scale and keep their game consistent across various menus and screens.At 137 pages, the UI e-book is not a light read. As with the other technical e-books released this past year, use it as a reference on an ongoing basis.Along with the e-book, check out a couple of recently released resources filled with useful tips for leveraging Unity UI and UI Toolkit:The Unite 2022 session, Extending the Unity Editor with custom tools using UI Toolkit, shows programmers how to use UI Builder to create a custom Inspector for real-time Play Mode debug data visualization.The webinar, Best practices for mobile UI design, gathers experts from Outfit7, Samsung, and Unity to share strategies for maximizing the creativity and flow of your mobile games.Bookmark one or both of these pages. They compile all of our technical e-books and advanced content:Unity best practicesAdvanced best practices – Unity ManualWe hope that you enjoy this latest e-book and look forward to your feedback in this forum. #its #all #here #ultimate #guide
    UNITY.COM
    It’s all in here: The ultimate guide to creating UI interfaces in Unity
    Thousands of people have preregistered and now it’s finally here: Our biggest e-book yet, User interface design and implementation in Unity, is available to download. Get ready to dive into over 130 pages of advanced instruction in UI design.Your game’s user interface is perhaps the most direct way you can communicate with and guide your players – like a folded map you hand to them that reveals clues, key details, and directions as they progress. Whether you’re using more traditional elements like health bars and pop-up messages, or elements completely embedded in the game world, such as showing stats on the back of a player’s survival suit, the UI is integral to immersing players in your game’s story, realm, and artistic style.We’re thrilled to announce that our latest technical e-book, User interface design and implementation in Unity, is available to download for free. Thousands of people have already signed up for it, and just as many have downloaded its companion piece, the demo project, UI Toolkit sample – Dragon Crashers, to date. Now it’s your turn.The interest in this e-book is understandable. As it says in the introduction, “User interface is a critical part of any game… a solid graphical user interface (GUI) is an extension of a game’s visual identity… [and] modern audiences crave refined, intuitive GUIs that seamlessly integrate with your application.”The guide begins by covering UI design and art creation fundamentals, and then moves on to in-depth instructional sections on UI development in Unity. Written and reviewed by technical and UI artists – external and Unity professionals alike – the e-book unpacks both Unity UI, the default solution, and the newer UI Toolkit.The emphasis, however, is on the latter toolset, as UI Toolkit now provides many benefits for projects with complex, fullscreen interfaces. Think of projects that require a scalable and performant system for runtime UI. To help you choose the right solution for your project, please refer to this section of the Unity manual.The e-book is a treasure trove of information for professional UI designers, artists, and other Unity creators who want to deepen their knowledge of UI development. Here’s a snapshot of what’s inside.The first section aims to inspire with foundational tips for making effective UI. It looks at examples of diegetic UIs, where UI elements can be found right in the story, making parts of the game world function as a user interface. It explains how elements can either contribute to or break the immersion that a player experiences. We even turned this section into a blog post that you can read here.The guide then turns to the roles and responsibilities of a UI designer, and what tools and methods they employ such as UI wireframing, art creation through mockups, fonts, and grey-boxing. There’s also a chapter on asset preparation and exporting graphics from Digital Content Creation (DCC) tools. These earlier sections in the guide are helpful no matter what game engine and UI solution you’re using.An extensive chapter is devoted to Unity UI. Unity UI is our longtime system for creating in-game UIs, and currently the go-to solution for positioning UI in a 3D world or using GameObject-based Unity systems.This section outlines Unity UI fundamentals for prototyping and integrating assets in-Editor: the Canvas, prebuilt UI elements, TextMesh Pro, and Prefabs, among others. We recently updated an article on advanced optimization techniques for Unity UI, where you can find tips on related topics.UI Toolkit is made for maximum performance and reusability with workflows and authoring tools informed by standard web technologies. UI designers and artists will likely find it familiar, especially with prior experience designing web pages.Three major sections of the guide highlight instructions for developing runtime UI with UI Toolkit. There’s a thorough explanation of the parts that comprise UIs made with UI Toolkit, including the Unity Extensible Markup Language (UXML) and Unity Style Sheet (USS) using UI Builder.You’ll explore how UI Toolkit positions visual elements based on Yoga, an HTML/CSS Layout engine that implements a subset of Flexbox. Flexbox architecture provides advantages, such as responsive UI, enabling you to adapt your UI to different screen resolutions and sizes. Through both UXML and USS, you can decouple the styles applied to UI layouts (and switch those styles up as needed), while logic and functionality continue to live in code. Workflows for visual elements, the fundamental building blocks of each interface, are also discussed in great detail – from positioning, size, and alignment settings, to margins and padding.The chapter on styling shows you how to define reusable styling for visual elements with Selectors, override styles and define unique attributes with inline styles, and create animations and effects with USS animation and a Camera Render Texture. It also demonstrates how you can thematize UI elements for holidays and other special events.That’s when the e-book gets into UI Toolkit sample – Dragon Crashers, with different sections that depict how the UI was made; from the menus and custom controls like radial counters or tabbed views, to embedded UXML templates and more.Finally, the guide concludes with a mini profile of the studio Mechanistry’s UI migration to UI Toolkit for their new game, Timberborn. This brief study showcases how their lean team managed to scale and keep their game consistent across various menus and screens.At 137 pages, the UI e-book is not a light read. As with the other technical e-books released this past year, use it as a reference on an ongoing basis.Along with the e-book, check out a couple of recently released resources filled with useful tips for leveraging Unity UI and UI Toolkit:The Unite 2022 session, Extending the Unity Editor with custom tools using UI Toolkit, shows programmers how to use UI Builder to create a custom Inspector for real-time Play Mode debug data visualization.The webinar, Best practices for mobile UI design, gathers experts from Outfit7, Samsung, and Unity to share strategies for maximizing the creativity and flow of your mobile games.Bookmark one or both of these pages. They compile all of our technical e-books and advanced content:Unity best practicesAdvanced best practices – Unity ManualWe hope that you enjoy this latest e-book and look forward to your feedback in this forum.
    0 Kommentare 0 Anteile
  • 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 Kommentare 0 Anteile
  • Rapid design iteration in Breachers using AssetPostprocessor and Blender

    Triangle Factory is a fast-growing Belgian gaming company that uses Unity to create high-quality multiplayer VR titles like Hyper Dash and their latest game, Breachers. Triangle Factory leverages tools like Cinemachine, Unity Profiler, Game Server Hosting, Matchmaker, Voice Chat, and Friends in creating an immersive experience for players.

    In this blog, Jel Sadones, lead level design/tech art, and lead developer Pieter Vantorre walk us through their Blender-to-Unity pipeline and how they brought their VR tactical FPS title Breachers to life.Unity has been our go-to engine and development environment for over a decade, and we have gone through many workflows over the years for environment modeling and design. That includes using in-engine modeling tools like ProBuilderand assembling scenes from Prefabs created in other modeling packages. For our current projects though, we’ve landed on a workflow where we model and organize our levels in Blender, and rely on Unity’s AssetPostprocessor to integrate them into our Unity project.In this article, we’ll share with you how we ended up with this workflow and how it supports the kind of rapid design iteration we need for our games.In 2021, we released our first big VR title, Hyper Dash, a fast-paced 5v5 arena shooter. When we started development on the game in 2019, we had a basic Blender-to-Unity workflow that probably looks familiar to many: We simply modeled geometry in Blender, exported our assets as FBX files and manually integrated them into Unity. The manual integration involved several steps:Setting up dynamic objects in the scene such as weapon pickups, spawn doors, capture pointsPlacing colliders to prevent players from walking or teleporting in certain areasSetting up invisible guides to allow bots to behave properlyEtc.This process can work well for smaller projects, but quickly becomes cumbersome as a project scales and evolves. When we started planning the development of our next title, we knew we were going to need a drastically improved workflow.Breachers is a competitive shooter with complex level layouts, subtler gameplay mechanics, more technical systems at play, and a higher level of graphical polish targeting the newest generation of standalone VR hardware. In terms of complexity, it goes several steps further than Hyper Dash, and we quickly felt the effects of this on our workflow.In the prototyping phase, we still relied heavily on Prefabs for dynamic objects, like window barricades for example. These are objects that we place inside window frames to block line of sight between interiors and the outside to prevent teams from seeing each other during the warm-up phase of the game.While testing our prototype, we were constantly moving around windows to improve gameplay, which meant changing geometry in Blender and re-exporting to Unity and then manually moving the barricade objects to match our changes. Many hours were spent flying around Unity’s Scene view, manually checking and fixing these kinds of things. Still, we had more than one playtest where we only noticed during gameplay that something had been overlooked.Obviously, this workflow was not going to give us the ability to quickly iterate on our map designs as we playtested, both internally and as part of our open alpha, where we planned to make one map available for free to get feedback from the community. We were looking forward to all that feedback, but not looking forward at all to the manual effort involved in applying it to our maps.Another potential downside to a Prefab-based design workflow is performance. We mainly target mobile, standalone VR headsets for our games. We want to push the visuals as far as we can, so we need to squeeze every last drop of performance out of our workflow.Assembling levels from Prefabs can be less efficient than creating a watertight mesh in a modeling program. If you snap two modular wall pieces together, you always have an unmerged loop of geometry in between them. With Prefabs, it’s also easy to end up placing a lot of geometry in your scene that isn’t visiblebut still taking up valuable lightmap space. Over an entire level, those small inefficiencies can add up to wasted performance and diminished visuals.The final issue with Prefabs we want to mention is that it can be easy to break things by applying seemingly innocent changes to the source model in Blender, like renaming an object. As a game or level evolves, you often want to reorganize your assets and give them improved or more consistent names. But renaming an object in Blender and re-exporting it can easilybreak the overrides and additions made to the object in Unity, leading to regressions.In this simplified example, we have a ventilation grate Prefab and want smoke coming out of it. After importing the mesh into Unity, our artist has added the smoke particle system as a child object and added a surface type component to the Prefab to mark it as being a metal object.Here you can see what happens if we rename our mesh in Blender:When reimporting the mesh with the updated name, Unity can no longer find the old mesh by name, so it removes the object from the model Prefab. Children of this removed object are moved to the root of the Prefab and existing scripts are removed, again leading to manual cleanup work we’d rather avoid.As the prototyping phase for Breachers wrapped up and we prepared to go into full production mode in early 2022, our art and dev teams sat down together and investigated what we could do to remedy these problems. We defined clear goals for our ideal asset pipeline, one that would support the rapid and flexible iteration required for Breachers:All creation and modification of level geometry should happen in Blender.WYSIWYG: What a designer creates in Blender should match the result in Unity as closely as possible.When something is updated in Blender, importing the changes into Unity should happen automatically and not require any manual effort.As mentioned above, our main goal was to have an accurate visualization of the game in Blender – not only properly reflecting how the end result will look in Unity but also how the gameplay mechanics are set up. Gameplay in Breachers not only depends on a level’s layout, but also on dynamic objectsand invisible elements. We want to have all this information visible at the design stage and carried over precisely to Unity.Custom properties are critical to our workflow, and we assign these to objects in Blender. These are then carried over in Unity by the FBX format, so we can read them and run custom logic when our assets are imported into Unity.This gives us a great amount of flexibility, as well as stability. These properties stay connected to objects throughout the pipeline, so we can reorganize and rename things in our levels as much as we want without worrying about things breaking or getting out of sync.Unity has a powerful class called AssetPostprocessor, which allows modifications of assets while they are being imported. This is what we use at import time to parse those custom properties and act on them.Prefab linksWe have a custom property named PrefabLink, which tells Unity the object imported from Blender should be replaced by a Prefab already in the Unity project, while preserving the imported model’s transform. This allows us to place these dynamic objects in Blender while retaining the advantages of Prefabs once they are imported into Unity. The window barricades in the Blender scene above are a good example of this.Surface typesSurface definition is extremely important in Breachers. Walking on a metal staircase sounds different from walking on a concrete floor. Bullet penetration through wood is a lot different than through steel. And each surface type has its own impact effects. Going over each prop in Unity and tagging it as the correct surface type would be extremely time consuming, so we also tackle this at the design stage in Blender by setting custom properties on our geometry colliders.Static flagsAnother important setting for optimization are Unity’s static flags. Setting these correctly can have a profound impact on things like visibility culling, light baking, and batching. Using custom properties in Blender, we can set these on any part of the level, including reusable props, and have that information carry over into Unity across our levels.CollidersLastly, we’d like to share how we set up colliders. Unity has a simple but effective system that automatically detects level-of-detail variants for models when you postfix a model asset name with _LOD0, _LOD1, etc. We were inspired by this and created a similar system for colliders: By simply having geometry with _BoxCollider or _NoCollision in the name, we replace the meshes from Blender with colliders in Unity.As a concrete example, here is a snippet of our LevelSetupPostprocessor that reads custom properties and assigns the right static flags on each imported object:For all of this to work smoothly, we did have to do some work on the Blender side as well.Custom properties are a bit hidden in Blender’s UI and would require artists to manually type out the custom properties each time, which is not a great user experience. Relying on manual text entry would also be very error-prone, undoing much of the advantage of setting things up in Blender in the first place. Moving from a Prefab-based workflow into Blender also made us miss some of the advantages of Prefabs, like having a nice library of objects to browse through and pick from. Luckily, Blender, like Unity, is very flexible and easily extensible.The answer to the Prefab organization problem came in Blender 3.2 with Asset Libraries. This system acts a bit like the Prefab system in Unity: It allows you to create assets in a separate file and then import those into your Blender scene, while changes in the asset file reflect automatically in the Blender scene. Additionally, it ensures that any custom properties or colliders are correctly applied to each instance of this asset in Blender.For Blender, we wrote an in-house add-on to help set up the custom properties in a more clear user interface. This simplifies setting custom properties by just selecting the relevant Blender objects and hitting a button, instead of typing out each property manually.The Bundle Exporter add-on is an open source add-on that we’re using to export all of our FBX files in one click. We modified it to also work with custom properties and updated the UI to have faster exports for our specific needs.Setting up our level design workflow for Breachers took a large time investment initially, but we believe it was the right choice for the project. Also, it was kind of fun!As we’ve built out the game from initial blockouts through alpha testing and the months leading up to the final release, iterating on our levels has been quick and painless. We’ve been able to eliminate overhead and busywork for our designers and artists, while also transferring responsibilities to them that they previously would have needed a developer for.We have been impressed at both Unity and Blender for their ability to integrate with each other this smoothly, and we strongly believe this integration was critical to making Breachers a game we’re happy with and proud to share with the world.Thanks for reading, and enjoy the game!Triangle Factory’s Breachers is now available. Check out more blogs from Made with Unity developers here.
    #rapid #design #iteration #breachers #using
    Rapid design iteration in Breachers using AssetPostprocessor and Blender
    Triangle Factory is a fast-growing Belgian gaming company that uses Unity to create high-quality multiplayer VR titles like Hyper Dash and their latest game, Breachers. Triangle Factory leverages tools like Cinemachine, Unity Profiler, Game Server Hosting, Matchmaker, Voice Chat, and Friends in creating an immersive experience for players. In this blog, Jel Sadones, lead level design/tech art, and lead developer Pieter Vantorre walk us through their Blender-to-Unity pipeline and how they brought their VR tactical FPS title Breachers to life.Unity has been our go-to engine and development environment for over a decade, and we have gone through many workflows over the years for environment modeling and design. That includes using in-engine modeling tools like ProBuilderand assembling scenes from Prefabs created in other modeling packages. For our current projects though, we’ve landed on a workflow where we model and organize our levels in Blender, and rely on Unity’s AssetPostprocessor to integrate them into our Unity project.In this article, we’ll share with you how we ended up with this workflow and how it supports the kind of rapid design iteration we need for our games.In 2021, we released our first big VR title, Hyper Dash, a fast-paced 5v5 arena shooter. When we started development on the game in 2019, we had a basic Blender-to-Unity workflow that probably looks familiar to many: We simply modeled geometry in Blender, exported our assets as FBX files and manually integrated them into Unity. The manual integration involved several steps:Setting up dynamic objects in the scene such as weapon pickups, spawn doors, capture pointsPlacing colliders to prevent players from walking or teleporting in certain areasSetting up invisible guides to allow bots to behave properlyEtc.This process can work well for smaller projects, but quickly becomes cumbersome as a project scales and evolves. When we started planning the development of our next title, we knew we were going to need a drastically improved workflow.Breachers is a competitive shooter with complex level layouts, subtler gameplay mechanics, more technical systems at play, and a higher level of graphical polish targeting the newest generation of standalone VR hardware. In terms of complexity, it goes several steps further than Hyper Dash, and we quickly felt the effects of this on our workflow.In the prototyping phase, we still relied heavily on Prefabs for dynamic objects, like window barricades for example. These are objects that we place inside window frames to block line of sight between interiors and the outside to prevent teams from seeing each other during the warm-up phase of the game.While testing our prototype, we were constantly moving around windows to improve gameplay, which meant changing geometry in Blender and re-exporting to Unity and then manually moving the barricade objects to match our changes. Many hours were spent flying around Unity’s Scene view, manually checking and fixing these kinds of things. Still, we had more than one playtest where we only noticed during gameplay that something had been overlooked.Obviously, this workflow was not going to give us the ability to quickly iterate on our map designs as we playtested, both internally and as part of our open alpha, where we planned to make one map available for free to get feedback from the community. We were looking forward to all that feedback, but not looking forward at all to the manual effort involved in applying it to our maps.Another potential downside to a Prefab-based design workflow is performance. We mainly target mobile, standalone VR headsets for our games. We want to push the visuals as far as we can, so we need to squeeze every last drop of performance out of our workflow.Assembling levels from Prefabs can be less efficient than creating a watertight mesh in a modeling program. If you snap two modular wall pieces together, you always have an unmerged loop of geometry in between them. With Prefabs, it’s also easy to end up placing a lot of geometry in your scene that isn’t visiblebut still taking up valuable lightmap space. Over an entire level, those small inefficiencies can add up to wasted performance and diminished visuals.The final issue with Prefabs we want to mention is that it can be easy to break things by applying seemingly innocent changes to the source model in Blender, like renaming an object. As a game or level evolves, you often want to reorganize your assets and give them improved or more consistent names. But renaming an object in Blender and re-exporting it can easilybreak the overrides and additions made to the object in Unity, leading to regressions.In this simplified example, we have a ventilation grate Prefab and want smoke coming out of it. After importing the mesh into Unity, our artist has added the smoke particle system as a child object and added a surface type component to the Prefab to mark it as being a metal object.Here you can see what happens if we rename our mesh in Blender:When reimporting the mesh with the updated name, Unity can no longer find the old mesh by name, so it removes the object from the model Prefab. Children of this removed object are moved to the root of the Prefab and existing scripts are removed, again leading to manual cleanup work we’d rather avoid.As the prototyping phase for Breachers wrapped up and we prepared to go into full production mode in early 2022, our art and dev teams sat down together and investigated what we could do to remedy these problems. We defined clear goals for our ideal asset pipeline, one that would support the rapid and flexible iteration required for Breachers:All creation and modification of level geometry should happen in Blender.WYSIWYG: What a designer creates in Blender should match the result in Unity as closely as possible.When something is updated in Blender, importing the changes into Unity should happen automatically and not require any manual effort.As mentioned above, our main goal was to have an accurate visualization of the game in Blender – not only properly reflecting how the end result will look in Unity but also how the gameplay mechanics are set up. Gameplay in Breachers not only depends on a level’s layout, but also on dynamic objectsand invisible elements. We want to have all this information visible at the design stage and carried over precisely to Unity.Custom properties are critical to our workflow, and we assign these to objects in Blender. These are then carried over in Unity by the FBX format, so we can read them and run custom logic when our assets are imported into Unity.This gives us a great amount of flexibility, as well as stability. These properties stay connected to objects throughout the pipeline, so we can reorganize and rename things in our levels as much as we want without worrying about things breaking or getting out of sync.Unity has a powerful class called AssetPostprocessor, which allows modifications of assets while they are being imported. This is what we use at import time to parse those custom properties and act on them.Prefab linksWe have a custom property named PrefabLink, which tells Unity the object imported from Blender should be replaced by a Prefab already in the Unity project, while preserving the imported model’s transform. This allows us to place these dynamic objects in Blender while retaining the advantages of Prefabs once they are imported into Unity. The window barricades in the Blender scene above are a good example of this.Surface typesSurface definition is extremely important in Breachers. Walking on a metal staircase sounds different from walking on a concrete floor. Bullet penetration through wood is a lot different than through steel. And each surface type has its own impact effects. Going over each prop in Unity and tagging it as the correct surface type would be extremely time consuming, so we also tackle this at the design stage in Blender by setting custom properties on our geometry colliders.Static flagsAnother important setting for optimization are Unity’s static flags. Setting these correctly can have a profound impact on things like visibility culling, light baking, and batching. Using custom properties in Blender, we can set these on any part of the level, including reusable props, and have that information carry over into Unity across our levels.CollidersLastly, we’d like to share how we set up colliders. Unity has a simple but effective system that automatically detects level-of-detail variants for models when you postfix a model asset name with _LOD0, _LOD1, etc. We were inspired by this and created a similar system for colliders: By simply having geometry with _BoxCollider or _NoCollision in the name, we replace the meshes from Blender with colliders in Unity.As a concrete example, here is a snippet of our LevelSetupPostprocessor that reads custom properties and assigns the right static flags on each imported object:For all of this to work smoothly, we did have to do some work on the Blender side as well.Custom properties are a bit hidden in Blender’s UI and would require artists to manually type out the custom properties each time, which is not a great user experience. Relying on manual text entry would also be very error-prone, undoing much of the advantage of setting things up in Blender in the first place. Moving from a Prefab-based workflow into Blender also made us miss some of the advantages of Prefabs, like having a nice library of objects to browse through and pick from. Luckily, Blender, like Unity, is very flexible and easily extensible.The answer to the Prefab organization problem came in Blender 3.2 with Asset Libraries. This system acts a bit like the Prefab system in Unity: It allows you to create assets in a separate file and then import those into your Blender scene, while changes in the asset file reflect automatically in the Blender scene. Additionally, it ensures that any custom properties or colliders are correctly applied to each instance of this asset in Blender.For Blender, we wrote an in-house add-on to help set up the custom properties in a more clear user interface. This simplifies setting custom properties by just selecting the relevant Blender objects and hitting a button, instead of typing out each property manually.The Bundle Exporter add-on is an open source add-on that we’re using to export all of our FBX files in one click. We modified it to also work with custom properties and updated the UI to have faster exports for our specific needs.Setting up our level design workflow for Breachers took a large time investment initially, but we believe it was the right choice for the project. Also, it was kind of fun!As we’ve built out the game from initial blockouts through alpha testing and the months leading up to the final release, iterating on our levels has been quick and painless. We’ve been able to eliminate overhead and busywork for our designers and artists, while also transferring responsibilities to them that they previously would have needed a developer for.We have been impressed at both Unity and Blender for their ability to integrate with each other this smoothly, and we strongly believe this integration was critical to making Breachers a game we’re happy with and proud to share with the world.Thanks for reading, and enjoy the game!Triangle Factory’s Breachers is now available. Check out more blogs from Made with Unity developers here. #rapid #design #iteration #breachers #using
    UNITY.COM
    Rapid design iteration in Breachers using AssetPostprocessor and Blender
    Triangle Factory is a fast-growing Belgian gaming company that uses Unity to create high-quality multiplayer VR titles like Hyper Dash and their latest game, Breachers. Triangle Factory leverages tools like Cinemachine, Unity Profiler, Game Server Hosting, Matchmaker, Voice Chat (Vivox), and Friends in creating an immersive experience for players. In this blog, Jel Sadones, lead level design/tech art, and lead developer Pieter Vantorre walk us through their Blender-to-Unity pipeline and how they brought their VR tactical FPS title Breachers to life.Unity has been our go-to engine and development environment for over a decade, and we have gone through many workflows over the years for environment modeling and design. That includes using in-engine modeling tools like ProBuilder (which we still use and love for rapid prototyping) and assembling scenes from Prefabs created in other modeling packages. For our current projects though, we’ve landed on a workflow where we model and organize our levels in Blender, and rely on Unity’s AssetPostprocessor to integrate them into our Unity project.In this article, we’ll share with you how we ended up with this workflow and how it supports the kind of rapid design iteration we need for our games.In 2021, we released our first big VR title, Hyper Dash, a fast-paced 5v5 arena shooter. When we started development on the game in 2019, we had a basic Blender-to-Unity workflow that probably looks familiar to many: We simply modeled geometry in Blender, exported our assets as FBX files and manually integrated them into Unity. The manual integration involved several steps:Setting up dynamic objects in the scene such as weapon pickups, spawn doors, capture pointsPlacing colliders to prevent players from walking or teleporting in certain areasSetting up invisible guides to allow bots to behave properlyEtc.This process can work well for smaller projects, but quickly becomes cumbersome as a project scales and evolves. When we started planning the development of our next title, we knew we were going to need a drastically improved workflow.Breachers is a competitive shooter with complex level layouts, subtler gameplay mechanics, more technical systems at play, and a higher level of graphical polish targeting the newest generation of standalone VR hardware. In terms of complexity, it goes several steps further than Hyper Dash, and we quickly felt the effects of this on our workflow.In the prototyping phase, we still relied heavily on Prefabs for dynamic objects, like window barricades for example. These are objects that we place inside window frames to block line of sight between interiors and the outside to prevent teams from seeing each other during the warm-up phase of the game.While testing our prototype, we were constantly moving around windows to improve gameplay, which meant changing geometry in Blender and re-exporting to Unity and then manually moving the barricade objects to match our changes. Many hours were spent flying around Unity’s Scene view, manually checking and fixing these kinds of things. Still, we had more than one playtest where we only noticed during gameplay that something had been overlooked.Obviously, this workflow was not going to give us the ability to quickly iterate on our map designs as we playtested, both internally and as part of our open alpha, where we planned to make one map available for free to get feedback from the community. We were looking forward to all that feedback, but not looking forward at all to the manual effort involved in applying it to our maps.Another potential downside to a Prefab-based design workflow is performance. We mainly target mobile, standalone VR headsets for our games. We want to push the visuals as far as we can, so we need to squeeze every last drop of performance out of our workflow.Assembling levels from Prefabs can be less efficient than creating a watertight mesh in a modeling program. If you snap two modular wall pieces together, you always have an unmerged loop of geometry in between them. With Prefabs, it’s also easy to end up placing a lot of geometry in your scene that isn’t visible (because it’s on the underside of an object, or placed against a wall) but still taking up valuable lightmap space. Over an entire level, those small inefficiencies can add up to wasted performance and diminished visuals.The final issue with Prefabs we want to mention is that it can be easy to break things by applying seemingly innocent changes to the source model in Blender, like renaming an object. As a game or level evolves, you often want to reorganize your assets and give them improved or more consistent names. But renaming an object in Blender and re-exporting it can easily (and without warning) break the overrides and additions made to the object in Unity, leading to regressions.In this simplified example, we have a ventilation grate Prefab and want smoke coming out of it. After importing the mesh into Unity, our artist has added the smoke particle system as a child object and added a surface type component to the Prefab to mark it as being a metal object.Here you can see what happens if we rename our mesh in Blender:When reimporting the mesh with the updated name, Unity can no longer find the old mesh by name, so it removes the object from the model Prefab. Children of this removed object are moved to the root of the Prefab and existing scripts are removed, again leading to manual cleanup work we’d rather avoid.As the prototyping phase for Breachers wrapped up and we prepared to go into full production mode in early 2022, our art and dev teams sat down together and investigated what we could do to remedy these problems. We defined clear goals for our ideal asset pipeline, one that would support the rapid and flexible iteration required for Breachers:All creation and modification of level geometry should happen in Blender.WYSIWYG: What a designer creates in Blender should match the result in Unity as closely as possible.When something is updated in Blender, importing the changes into Unity should happen automatically and not require any manual effort.As mentioned above, our main goal was to have an accurate visualization of the game in Blender – not only properly reflecting how the end result will look in Unity but also how the gameplay mechanics are set up. Gameplay in Breachers not only depends on a level’s layout, but also on dynamic objects (like breachable walls) and invisible elements (like sound volumes and colliders). We want to have all this information visible at the design stage and carried over precisely to Unity.Custom properties are critical to our workflow, and we assign these to objects in Blender. These are then carried over in Unity by the FBX format, so we can read them and run custom logic when our assets are imported into Unity.This gives us a great amount of flexibility, as well as stability. These properties stay connected to objects throughout the pipeline, so we can reorganize and rename things in our levels as much as we want without worrying about things breaking or getting out of sync.Unity has a powerful class called AssetPostprocessor, which allows modifications of assets while they are being imported. This is what we use at import time to parse those custom properties and act on them.Prefab linksWe have a custom property named PrefabLink, which tells Unity the object imported from Blender should be replaced by a Prefab already in the Unity project, while preserving the imported model’s transform. This allows us to place these dynamic objects in Blender while retaining the advantages of Prefabs once they are imported into Unity. The window barricades in the Blender scene above are a good example of this.Surface typesSurface definition is extremely important in Breachers. Walking on a metal staircase sounds different from walking on a concrete floor. Bullet penetration through wood is a lot different than through steel. And each surface type has its own impact effects. Going over each prop in Unity and tagging it as the correct surface type would be extremely time consuming, so we also tackle this at the design stage in Blender by setting custom properties on our geometry colliders.Static flagsAnother important setting for optimization are Unity’s static flags. Setting these correctly can have a profound impact on things like visibility culling, light baking, and batching. Using custom properties in Blender, we can set these on any part of the level, including reusable props, and have that information carry over into Unity across our levels.CollidersLastly, we’d like to share how we set up colliders. Unity has a simple but effective system that automatically detects level-of-detail variants for models when you postfix a model asset name with _LOD0, _LOD1, etc. We were inspired by this and created a similar system for colliders: By simply having geometry with _BoxCollider or _NoCollision in the name, we replace the meshes from Blender with colliders in Unity.As a concrete example, here is a snippet of our LevelSetupPostprocessor that reads custom properties and assigns the right static flags on each imported object:For all of this to work smoothly, we did have to do some work on the Blender side as well.Custom properties are a bit hidden in Blender’s UI and would require artists to manually type out the custom properties each time, which is not a great user experience. Relying on manual text entry would also be very error-prone, undoing much of the advantage of setting things up in Blender in the first place. Moving from a Prefab-based workflow into Blender also made us miss some of the advantages of Prefabs, like having a nice library of objects to browse through and pick from. Luckily, Blender, like Unity, is very flexible and easily extensible.The answer to the Prefab organization problem came in Blender 3.2 with Asset Libraries. This system acts a bit like the Prefab system in Unity: It allows you to create assets in a separate file and then import those into your Blender scene, while changes in the asset file reflect automatically in the Blender scene. Additionally, it ensures that any custom properties or colliders are correctly applied to each instance of this asset in Blender.For Blender, we wrote an in-house add-on to help set up the custom properties in a more clear user interface. This simplifies setting custom properties by just selecting the relevant Blender objects and hitting a button, instead of typing out each property manually.The Bundle Exporter add-on is an open source add-on that we’re using to export all of our FBX files in one click. We modified it to also work with custom properties and updated the UI to have faster exports for our specific needs.Setting up our level design workflow for Breachers took a large time investment initially, but we believe it was the right choice for the project. Also, it was kind of fun!As we’ve built out the game from initial blockouts through alpha testing and the months leading up to the final release, iterating on our levels has been quick and painless. We’ve been able to eliminate overhead and busywork for our designers and artists, while also transferring responsibilities to them that they previously would have needed a developer for.We have been impressed at both Unity and Blender for their ability to integrate with each other this smoothly, and we strongly believe this integration was critical to making Breachers a game we’re happy with and proud to share with the world.Thanks for reading, and enjoy the game!Triangle Factory’s Breachers is now available. Check out more blogs from Made with Unity developers here.
    0 Kommentare 0 Anteile
Suchergebnis