✅ Get the FULL course here at 80% OFF!! 🌍 unitycodemonkey.com/courseultimateoverview.php 👍 Learn how to make BETTER games FASTER by using all the Unity Tools and Features at your disposal!
hi, i have a 3d game, how can i load only those resources that the player sees through the camera? I could check their position, but they are not on stage. I could ray cast, but they are not on stage. And if they are loaded into memory, the meaning of dynamic loading is lost. There is an idea to record their bounding box, and check the visibility on them, but I don't really understand how. Thank you for the lesson!
@@vicktoriashepard You don't want to unload and reload objects that should be in the scene. Frustum culling will prevent them from rendering when they're not being looked at, but completely unloading and reloading the objects while looking around would destroy the performance of your game. If you are talking about objects that are not nearby and wouldn't be visible even when looking around then you're talking more about world streaming. In that case you have to divide the world into sections and load or unload entire sections based on proximity.
This video was launched 20 minutes after a daily meeting i've had with my team, where we discussed that the next step in our game was to study and implement adressables. I knew Facebook was spying us, but you?!!?! LOL
18:36 You don't even need to define new classes to forgo the generic type parameters when writing your AssetReference! Instead of defining a new class, just import the generic type AssetReferenceT as an alias with the desired type, like so: using AssetReferenceAudioClip = UnityEngine.AddressableAssets.AssetReferenceT; //note that it's necessary to use fully qualified namespace names - don't omit the UnityEngine part even if it's among your imports Way less cluttery, and now you don't have an extra class to keep track of. Additionally any alias for AssetReferenceT is fully interchangeable with any other object defined through such alias. Sub-classes are NOT interchangeable and if you define two different classes AssetReferenceAudioClip they can never replace each other.
Been using this for awhile now, just have to mention while in the editor after making a build you might want to set the Play Mode Script to Use Existing Build this will show you in the editor what loading will be like in a Player. Addressables is great it has fixed a lot of the memory issues my project was suffering from.
@@lee1davis1 Does not need to be big, I use addressables in smaller projects too. Having small resource folder and using addressables instead can be very good, imagine if you have a cutscene or any type of object that has a small lifetime during your game, instead of having his resources loaded and occupy memory at runtime you can only load it when you need it and remove it after that, it's a very good practice to use only the resources that you need. Lower RAM means that you can add more details or target lower end devices, also coupled with other optimization techniques and the device won't heat up during the gameplay. So lower build time (no resources folders, addressables content is build independent of project build), lower load time (no unused dependencies in scenes) and lower memory footprint. Addressables should be the way to go for any object that has a limited lifespan during the gameplay (at least imo)
Great comprehensive tutorial on addressables! I can't thank you enough for the time and effort you put into creating this video. It has helped me tremendously in understanding and implementing addressables in my own projects. Your clear explanations, step-by-step guidance, and real-world examples made it so much easier to grasp the concepts. Keep up the fantastic work, and I look forward to watching more of your tutorials in the future!
Host I use all the time for testing the VR headset ( remote device) before moving the content to the unity buckets. Addressables can make you build bigger because of duplicates between groups, something to be aware of. That said our build is 1gb and +2gb come frome the remote buckets, when required, so its a huge benefit.
I just bought you turn based strategy course some days ago and loved it!! Im gonna be probably buying this ultimate unity overview couse soon. You explain very well and in lots of detail, I consider myself an intermediate experienced dev, but most of the things you tech I didnt know :) Thats awesome
I'm planning to make a slightly larger scoped game next, and learning about this stuff has mostly been a nightmare. Thanks so much for explaining it in a clear way.
Very cool... these free videos are a really great resource! They're helping me wrap my head around Gamedev and coding (so I'm starting to feel like I'm slowly getting a grasp on them). It's a really important part of the journey that happens before you can make the decision that buying a course will be worth it for you/your goals (I'm getting there).
Amazing video! I am so happy you made it - it took me ages to get to know about them so it's great to have one place to get to know all about them! There's only one sad thing about the video. I was learning it all to make the video myself! :D
I just bought your Ultimate Unity Overview and Unity Turn-Based Strategy Game Courses! So excited to start them! I'll start after finishing my ongoing projects, can't wait to learn new things! Do you have a discord or something where we can ask questions to? I just think that it would be fun to interact with you and your other students while learning your courses.
I hope you like them! I tried Discord but it was impossible to be responsive since Discord is based on real-time I'm always available on the Q&A section of the courses, I answer all questions every day so if you need any help with anything just ask there and I'll do my best to help Thanks!
Entirely Asynchronous is what you meant saying at 1:24. If it were entirely synchronous everything would be frozen. They do have a method call for synchronous loading, but calling this method will cause ALL other addressables that are asynchronously loading, to be loaded synchronously as well. It ain't advised to use that synchronous method, but some ppl in the community were complaining that everything was asynchronous. Addressables are awesome. But they do come with their own problems though. Especially when using scriptable object events. If you have a reference in the built-in scene and addressable load something that references that same scriptable object. Then it will be another instance of the scriptable object. So the scriptable object referenced in the scene is not the same as the one from the addressable loaded asset. Unless you load the scene itself as addressable it'll be the same again. Having addressables hosted on a content server makes it easy to do hot fixes. Forgot a reference? change the prefab or scene and just build the new addressables and put it on the server again. Fixed. No need for a new app build. You can make an in-game message stating that assets have been updated, get the new catalog, update the assets and reload the main scene.
@@lee1davis1 Yeah though, this hot fixing is only for bugs within assets. If there are bugs in your programming you'd still need a new build. Addressables doesn't allow code to be shipped. That's something that should be mentioned. So you can't update code with addressables, but you can update assets.
Amazing, only problem is, if I end up bookmarking all your videos, bookmarks become meaningless, I think the thumbnail should be changed to Addressable. I might strugle to find this in the future because of the thumbnail I dont know how you add so much detail in such short period of time, considering the rate at which you make content! Keep it up I just realized this is part of the course which I have purchased but I have not started yet
This was a tough video to make a thumbnail for, I'm not sure most people know what is Addressables so I chose to use that in the title and focus on one of the main benefits for the thumbnail. So by the title it should be searchable.
at 9:35, I notice that you magically pressed a short cut key to auto generate the AsyncOperationHandle_Completed event and its function. How did you do that?
It's Visual Studio's default auto-completion, after you type += on an event if you press Tab it auto completes the event function. I don't think VS Code has it, at least not by default, I'm using VS Community
I don't like that registering to the completed even occurs after the call to load the asset. In my eyes that is just bad flow, the completed event might fire before you get a chance to register for it. There might be some behind the scenes logic that the AsyncOperationHandle could check if its already completed when new subscriptions are assigned. However I still don't like how it looks in my code.
Since the whole system is asynchronous I don't think it's possible for the event to fire before you register it, I think even when loading a 1KB file it will take at least one Update to complete so I don't believe that's a problem.
Add UniTask to your project and it’s super clean again, no ugly callback/event stuff: private async UniTask LoadAsync() { var go = await Addressables.LoadAssetAsync(…); Instantiate(go); } Ugly stuff is behind the scenes and we got a nice API. Also, UniTask is pretty much a standard Asset to use because all async/coroutine stuff is much better writeable and handleable :)
Super Tutorial Thank you for this and the ones following up on this with the cloud tutorial. Also just a request for maybe a async cloud based game in the future.
16:00 how you use label with string? is it same with AsyncOperationHandle asyncOperation = Addressables.LoadAssetAsync("Assets/_MS/Model/test.fbx"); but just label like ("environment")
Almost jelly how much faster you seem to learn newer unity concepts and absorb how they work. Oh and make a hey gang here's the whole thing dissected and explained.. Meanwhile I gotta watch your video 3 times along with a slew of support alternatives to have any level of a working grasp on some of these things at all Sigh
Thank you, very helpful. I can see how this would be useful for managing things like weapons/armor/clothing that might change frequently on characters/NPCs.
One thing that's currently confusing me about Addressables is that using them seems to remove the usefulness of the editor? If all the assets need to be asynchronously loaded, what do you do during design time? For example, while creating your scene, and putting all the environment assets where you want them to be? If you make them addressables, you can't view them in the scene anymore, can you?
I think it’s more for optimising and should be used after your scenes are complete. The whole point of addressables is to minimise ram usage by dynamically loading assets from the disk while the game is running. It has nothing to do with the editor.
Amazing video 👏. Really helped me reduce my game size. I also watched your video on unity gaming services so i wanted to ask : Are you planning to make a video on how Cloud Content Delivery can be linked with addressables?
@@CodeMonkeyUnity i did see that now on your paid course, can you maybe post it on youtube too (as no one has properly covered it yet) or maybe just add a feature to just buy the particular video because i cannot really buy the entire course for one video. Thanks for the reply.
Quick question.. Is it really a good practice having the whole scene as a prefab? Or was just an example? I don't know if addreassables support scenes directly or not, but for baking light and that stuff it would be important. Or is it more oriented to "simple" assets instead of something like a scene?. Also, does it allow you to include new scripts with those packages? Or do you need a new build? Thank you!
It was mainly just an example, depending on the size of your level you might be ok with making it a single prefab if it's relatively small but definitely don't make it a single prefab if you have something on the scale of Skyrim. On a large world you would split it into chunks then use Addressables to dynamically load/unload them as the player moves to have no loading even in a huge world. Addressables is only meant for assets, not code. You can reference scripts that were included in the build, but you cannot include extra code in the addressables that wasn't present in the original build.
Really helpfull and professional content, I already learned a lot from yout channel! Thanks a lot! Would be great to see how to make a melee combat system with finalization and slow motion in the last hit on the enemies.
This video is a sample from my Ultimate Unity Overview course, the other 2 lectures on Remote Addressables and Cloud Content Delivery are available on the course unitycodemonkey.com/courses.php?c=ultimateoverview
I would love it so much if you could make more tutorials about Netcode and multiplayer with unity game service! The first tutorial about Netcode was great, a full overview of Boss Room soon would be such an amazing gift for us ♥️♥️♥️
I've been using addressables for a while now. I wasn't aware that the addressables are built upon a unity build like in the video? I always remember manually having to build addressables individually. What do I have to do to have this behaviour by default? Very nice video by the way. Even if I already know how this all works, it's great to solidify my knowledge. I like how the video only used minimal code, as it's way too easy to overengineer with addressables while self-learning this like I did :)
There are both methods, I believe this behaviour is the default, I don't remember changing anything to make it build alongside the game build. After making the build then there's another menu to update a previously created asset bundle, it's what I used in the Cloud Content Delivery lecture to update some assets on the server.
I'm asking this before watching, can addressables be good for let's say a battle pass in a game? Like load each tier as a scriptable object that you load in your game maybe? Thanks
Nice tutorial. Can you make more tutorial about download Addressables player content from cloud from initialization then load from local at runtime ? Thank you
If you use Addressables remote then you have that behaviour by default, the system is smart enough to first check for the hash on the remote server and only downloads all the data if the hash changed, if not then it uses the cached data
Hello CodeMonkey. I think the best idea for this thing position based addressables. Like if player close to assets load that if far unload. Can we make like this demo?
Hello @CodeMonkeyUnity, How can I customize remote download URL async at runtime via script? For example, if my host require private authen token included in download URL. Thank you
Thank you again for tutorial :) I don't understand, Is Adressables is completely replaces the Asset bundles common flow in Unity? Or I still have to choose what approach to use - Asset Bundles or Adressables?
Addressables is a tool built on top of Asset Bundles. When you make a build the system will go through all the Addressables you set up and automatically create all the asset bundles
That was Great Video and i have a question that can we load multiple Addressable Scenes at same time? and if we are loading whole scene from cloud how can we reload it in our game as it is'nt in our build settings so SceneManager.loadScene(0) will not work! waiting for Answer
Thx very much. Can I ask? I have sets of scenes with large maps, the unity project would have like 100GB if I have them all in one project. I used asset bundles and add the chosen maps to the project or to the build to keep it small. Can I use addressables to achieve similar result? It took quite long to load large map from asset bundle
I'm having an on my Quest app with addressable . My scene slows down when it is set as an addressable, and runs smoothly when loaded locally. I used Occlusion culling to get this fat scene to work smoothly at 90 FPS. Occlusion culling seems not working on Android addressable scenes could explain my problem.
Just curious. I love your videos, but how come you don't use the practice of using var myvar instead of AsyncOperationHandle myvar? I know this is a huge debate in the c# world. I prefer it over having to redefine the type in the event the assignment needs to change later due to requirements changing, and Ide's convert it at compile time anyway, so there really is no performance gain over one or the other.
@@blockify If you're coding on your own, it absolutely is up to personal preference. In a professional environment, you have to follow the code standards the company sets. companies are more often than not going with the "var" standard (It's even a highlighted nit in Rider), which is why I asked. Anyway, was just curious, not attempting to come down on anyone. :)
I'm currently working on a project and I want to load the scenes remotely through addressables. I have a doubt ,after downloading the scene 1 from cloud in play mode, will that downloaded scene remains in the project or it has to be downloaded again after exiting from the playmode
Sprite load is not working on builds :/ even tough implementation is perfect & works in PlayModeScript set to UserAssetDatabase but does not work in other play mode script or in real build
@@CodeMonkeyUnity An event subscription will keep an object from being garbage collected. Most memory leaks in C# come from creating an event subscription without unsubscribing later
Can you add links after every video from where you learn all the stuff, it would help us in searching our bugs, buz searching from google is skill too isn't it?.
How can i implement it in a open world game (should i?). like should i use box triggers at different place and load the near by terrains when player triggers it, or can i make some sort of world streaming system which would load and unload terrains when the player is colse ( im not really sure of the second method definitely need some insites on this.)
Yup if you have an open world game you should definitely implement some kind of world streaming system to keep your game performant. And yes you would basically split your world into multiple chunks, and load/unload chunks as the player moves through the world.
Just wondering with Asset Bundles you are able to create an asset Bundle in one project and then load them in a game built from a totally different project. Is that possible with Addressables or would you have to set up the addressables from the project that you are building your game with? Basically I'd love to have one project just for world building where the addressables would be created from, then other projects for Server, Client, Maybe a Game Editor, and maybe a Offline World Viewer or something like that and share the addressables between all the projects.
Hmm I haven't tried out that scenario but Addressables is built on top of Asset Bundles so if you can do that with Asset Bundles then it sounds like you would be able to build the same thing with Addressables
Nice ❤ i play some games they’re disabled objects when player far from it and it enable it when it’s near like house when you far you can’t see but when you be close you see it is this system good? I am sorry my English not good 😅
Hmm sure you could load a simple Billboard when the player is far away and use Addressables to load the full object as the player moves closer, that would be a good use case.
Apart from addressables' CDN feature, what's the difference between loading scenes (containing some parts of the game environment) additively and using addressables to load a group of the same game environment parts(labels)?
Functionally they would be similar, if you load a scene additively it has pretty much the same result as loading a giant prefab with addressables. The main benefit is with addressables you have more control, you can make a single texture or mesh addressable, whereas with the scene method you'd need to place that object on a separate scene
@@CodeMonkeyUnity ok understandable, though I found it confusing that you mentioned in the video that you will later describe remote uses of addressables without mentioning that this will happen in another, paid video Besides that, this is clearly quality content
Hi ! Do you plan on making somes tutorial about FPS ? In mean by that, some kind of controller, shooting behaviours, recoil, reloading or any of theses subjects ? Theses are just example but i think it would be great to have some kind of tutorial from.you on this very popular type of gameplay ! Thanks for Reading 😇
FPS is indeed a genre I'd like to cover, I haven't really made many videos on it, only made my FPS Microgame unitycodemonkey.com/video.php?v=twMkGTqyZvI Although I did cover a bit of shooting logic in my Third Person Shooter, it's pretty much the same in first person, just different animations unitycodemonkey.com/video.php?v=FbM4CkqtOuA
very helpful video, but can i ask you this question, i'm referencing a prefab containing 200 sprites in my script, but why using Addressable still takes 5 seconds to finish loading that prefab, seems how Doing this still doesn't load faster than the normal reference way
@@CodeMonkeyUnity The issue is you titled your video "How to use Addressables FASTER Loading" etc. I came here looking to find a way around some of the slow addressable loading. What you meant is "load the initial scene faster", I suppose. Even though that's still a bit (unintentionally) misleading, since the scene isn't usable without the other stuff then getting loaded.
@CodeMonkeyUnity Why doesn't my memory release after instantiating an object in Addressables prefab? It starts at 65MB, goes up to 150MB, but when released it only goes down to ~120MB instead of the original 65MB. Why?
Great video. Will this be useful for mobile games? What is the best way to do this when we are reloading the same scene again after a failure or something?
@@CodeMonkeyUnity what about reloading the same scene again? Is there a better way to do that? Or a different way to load and unload objects? Or is marking them inactive good enough?
hey codemonkey I was wondering if you think this would be possible and if so where to look. I want to make a system like skyrim where entering a building takes you to an entirely different scene thats approximately the same size as the house. the problem is that I want to make a prefab of it so its scalable so if I place down another house prefab I don't want it to enter the interior of a different house. I want it to create its own instance of the interior especially if I want these houses to be generated procedurally. Is there a way to make these prefabs create a new generic interior scene(one I have premade but want to reuse for different building interiors). This question seems to be a little complicated to ask so I hope it makes sense.
Sure, sounds like you just need some kind of level editor so you can build a house interior with a bunch of modular parts, then save that level data somewhere, perhaps a scriptable object, and when entering the house ask the house object for the level data and load that level. Alternatively if you don't want to do it through code you can place the house interior in a prefab then for each house object you attach a house script that has a reference to that prefab, you load the empty interior scene and spawn that prefab. Just assign different prefabs to different houses.
Yup async loading a scene would work the same, the benefit of this system is you don't need to create an entire scene, you can individually load just a single prefab or texture or anything.
The course has all 50+ lectures, here on RUclips I only uploaded about 4 free samples. For example this lecture on Addressables is a free sample exactly like the course lecture, but the following 2 lectures on addressables remote aren't available here on RUclips
i got a question. why would someone choose this method instead of having multiple scenes and loading and unloading them respectively ? (watching the video , at least to my experience with mutiple scenes its the exact same functionality)
With this, you can micromanage assets of individual scenes too. That can give you extra performance boost. Also, main advantage of it is to store data in cloud and download new assets or update old assets without releasing new builds and also reducing the build size.
Sure, in terms of memory control both techniques can be used to similar results. I would say addressables is much easier to use if you have smaller use cases, like for example you want to load just one special enemy or a special sprite, with scene additive loading you would need to make a scene just for that enemy or sprite whereas here you just tick the box and mark it addressable. And beyond memory management the other main purpose of addressables is downloading new content from the cloud, like updated assets for a special event, can't do that with just scene additive loading.
Can someone explain to me why there is so much garbage still loaded after unloading addressables ? In video at 24.39 Started project with ~136 mb of ram usage at 24.52 code monkey has loaded addressables with enviro and ram usage jumped to ~616 mb at 24.55 code monkey has unloaded addressables and ram usage lowered to ~ 257 mb. There is still 120 mb of ram that was not unloaded. Can we do something about it ?
As far as I know Unity has various optimizations that will attempt to use as much memory as possible as long as the device still has memory, so in that case I assume it keeps some things cached just in case you want to load those same assets in the future, and it will only completely unload that memory if the device is nearing the limit.
@@CodeMonkeyUnity first of all thank you for anwser. Secondary I'm making R&D in this topic for my project with memory profiler and noticed some things related to my question that may help other users. 1) When you had empty scene you were not using almost any materials and assets. When you loaded enviro it loaded all assets related to this prefab. In it were for example elements with lit shader. Most people don't know but when you requesting material it is loading much more then just material and it shader. For example it needs to load "error" shader and create material instance of it to have chance to display it if something goes wrong. If you then unload your enviro it will not unload those "debug" shader and material. This case is not only for materials. Similar situation takes part in other object's type. 2) It is a bit follow up but it won't pile those "garbage" endlessly. If you Load Unload and repeat process you will not create additional garbage (at least amount will significantly lower). 3) It is a bit connected if you want to manage your memory by addressables scenes there are some ways but it is not so great ideea. There is UnloadSceneOptions.UnloadAllEmbeddedSceneObjects for additive scenes. You must know that even if you mark unload as UnloadSceneOptions.UnloadAllEmbeddedSceneObjects it will only unload all resources that are serialize in scene. So for example every object that you spawn dynamically will not be unloaded. You need to know as well something a bit obvious that when you are loading scene and any script on this scene that reference prefab or any other resources needs to be loaded with scene. 4) As CodeMonkey mentioned in comment above yes Unity has some build in solution to leave some elements not unloaded even when requested. It is kind of optimization that is great for 95% of use case but in other 5% is annoying as hell and there is no (at least known to me) way of disabling it. Bonus : It is not mention in video but i think it is some great info. When you are loading addressables from label and in this label you've got different types of objects. I'm recommending to use Addressables.LoadResourceLocationsAsync(labelName) that has callback with AsyncOperationHandle asyncOperationHandle where you are dystyngiush type of object.
Visual Scripting has the same nodes as C# so all the functions you see in this video can be called from VS, just make sure you add the multiplayer assemblies and all the nodes will show up
@@CodeMonkeyUnity beauty, thanks bud. Yeah I got the nodes going and just playing around with setting up subgraphs and such to make it easy. takes a while to translate from typed script to nodes, but totally doable. I guess what I need is to start with a login screen, most folks show how to setup the player object not so much how to setup the login screen. hard to get good feedback to see what's going on you know? like how you use your console thing
✅ Get the FULL course here at 80% OFF!! 🌍 unitycodemonkey.com/courseultimateoverview.php
👍 Learn how to make BETTER games FASTER by using all the Unity Tools and Features at your disposal!
hi, i have a 3d game, how can i load only those resources that the player sees through the camera? I could check their position, but they are not on stage. I could ray cast, but they are not on stage. And if they are loaded into memory, the meaning of dynamic loading is lost. There is an idea to record their bounding box, and check the visibility on them, but I don't really understand how. Thank you for the lesson!
Hi CodeMonkey, are you going to do a video on the Unity UI toolkit?
@@Nova04550 It's on my list, I've already done a bunch of research but haven't written a video yet
@@CodeMonkeyUnity Sweet! Really looking forward to that.
@@vicktoriashepard You don't want to unload and reload objects that should be in the scene. Frustum culling will prevent them from rendering when they're not being looked at, but completely unloading and reloading the objects while looking around would destroy the performance of your game. If you are talking about objects that are not nearby and wouldn't be visible even when looking around then you're talking more about world streaming. In that case you have to divide the world into sections and load or unload entire sections based on proximity.
This video was launched 20 minutes after a daily meeting i've had with my team, where we discussed that the next step in our game was to study and implement adressables. I knew Facebook was spying us, but you?!!?! LOL
It's a great package! Best of luck with your game!
@@CodeMonkeyUnity Thank you very much!
18:36 You don't even need to define new classes to forgo the generic type parameters when writing your AssetReference!
Instead of defining a new class, just import the generic type AssetReferenceT as an alias with the desired type, like so:
using AssetReferenceAudioClip = UnityEngine.AddressableAssets.AssetReferenceT;
//note that it's necessary to use fully qualified namespace names - don't omit the UnityEngine part even if it's among your imports
Way less cluttery, and now you don't have an extra class to keep track of. Additionally any alias for AssetReferenceT is fully interchangeable with any other object defined through such alias. Sub-classes are NOT interchangeable and if you define two different classes AssetReferenceAudioClip they can never replace each other.
can't wait for the sequel to this tutorial! Remote hosting addressables will be a life saver.
YOURE SAVIOUR MAN, last few videos were EXACTLY what I needed at that point.
Been using this for awhile now, just have to mention while in the editor after making a build you might want to set the Play Mode Script to Use Existing Build this will show you in the editor what loading will be like in a Player. Addressables is great it has fixed a lot of the memory issues my project was suffering from.
I'd love to hear more about how it helped. I currently on see addressable as useful if you are making a large scale game or mobile app.
@@lee1davis1 Does not need to be big, I use addressables in smaller projects too. Having small resource folder and using addressables instead can be very good, imagine if you have a cutscene or any type of object that has a small lifetime during your game, instead of having his resources loaded and occupy memory at runtime you can only load it when you need it and remove it after that, it's a very good practice to use only the resources that you need. Lower RAM means that you can add more details or target lower end devices, also coupled with other optimization techniques and the device won't heat up during the gameplay. So lower build time (no resources folders, addressables content is build independent of project build), lower load time (no unused dependencies in scenes) and lower memory footprint. Addressables should be the way to go for any object that has a limited lifespan during the gameplay (at least imo)
Great comprehensive tutorial on addressables! I can't thank you enough for the time and effort you put into creating this video. It has helped me tremendously in understanding and implementing addressables in my own projects. Your clear explanations, step-by-step guidance, and real-world examples made it so much easier to grasp the concepts. Keep up the fantastic work, and I look forward to watching more of your tutorials in the future!
That's awesome, I'm glad the video helped you! Thanks!
You can also use LoadAssetsAsync to retrieve a list of objects of the specified Type T to process!
Host I use all the time for testing the VR headset ( remote device) before moving the content to the unity buckets. Addressables can make you build bigger because of duplicates between groups, something to be aware of. That said our build is 1gb and +2gb come frome the remote buckets, when required, so its a huge benefit.
I just bought you turn based strategy course some days ago and loved it!! Im gonna be probably buying this ultimate unity overview couse soon. You explain very well and in lots of detail, I consider myself an intermediate experienced dev, but most of the things you tech I didnt know :) Thats awesome
go for it, it's also a nice course ;)
That's awesome, I'm glad you're enjoying the course! Thanks!
I'm planning to make a slightly larger scoped game next, and learning about this stuff has mostly been a nightmare. Thanks so much for explaining it in a clear way.
Very cool... these free videos are a really great resource!
They're helping me wrap my head around Gamedev and coding (so I'm starting to feel like I'm slowly getting a grasp on them).
It's a really important part of the journey that happens before you can make the decision that buying a course will be worth it for you/your goals (I'm getting there).
I've been working with Addressables, but you've covered some info I just didn't take attention on. Can't wait for a new vid about addressables
Amazing video! I am so happy you made it - it took me ages to get to know about them so it's great to have one place to get to know all about them! There's only one sad thing about the video. I was learning it all to make the video myself! :D
I just bought your Ultimate Unity Overview and Unity Turn-Based Strategy Game Courses!
So excited to start them! I'll start after finishing my ongoing projects, can't wait to learn new things!
Do you have a discord or something where we can ask questions to? I just think that it would be fun to interact with you and your other students while learning your courses.
I hope you like them!
I tried Discord but it was impossible to be responsive since Discord is based on real-time
I'm always available on the Q&A section of the courses, I answer all questions every day so if you need any help with anything just ask there and I'll do my best to help
Thanks!
@@CodeMonkeyUnity i seeee~ well, I'll just send messages when I have questions. Thank you for the great courses!
That was a great video! I was just about to look into addressables when your video popped up in my feed! Great timing - and thanks for the video!
You’re a great coder and a great teacher. I always know how, and importantly, why, when watching your videos!
Thank you so much! 🙂Perfectly explained. You're one of my all time personal heroes! 🍻
Thanks! I'm glad the video helped you!
Really good tutorial! I didn’t even know this was a thing that can be done.
Another nicely explained tutorial! Also, do you plan to expand on the NPC system (like movement, more behavior, etc)
Thanks for the tutorial! I didn't know there were so many approaches with this package!
Entirely Asynchronous is what you meant saying at 1:24.
If it were entirely synchronous everything would be frozen.
They do have a method call for synchronous loading, but calling this method will cause ALL other addressables that are asynchronously loading, to be loaded synchronously as well.
It ain't advised to use that synchronous method, but some ppl in the community were complaining that everything was asynchronous.
Addressables are awesome. But they do come with their own problems though.
Especially when using scriptable object events. If you have a reference in the built-in scene and addressable load something that references that same scriptable object. Then it will be another instance of the scriptable object. So the scriptable object referenced in the scene is not the same as the one from the addressable loaded asset.
Unless you load the scene itself as addressable it'll be the same again.
Having addressables hosted on a content server makes it easy to do hot fixes. Forgot a reference? change the prefab or scene and just build the new addressables and put it on the server again. Fixed. No need for a new app build. You can make an in-game message stating that assets have been updated, get the new catalog, update the assets and reload the main scene.
See. Your example is the best use case for Add,s that I've seen. True. No need to re-download the entire build if the game only has a small bug fix.
@@lee1davis1 Yeah though, this hot fixing is only for bugs within assets. If there are bugs in your programming you'd still need a new build.
Addressables doesn't allow code to be shipped. That's something that should be mentioned. So you can't update code with addressables, but you can update assets.
Great tutorial with good and logical structure!
Awesome tutorial, I was wanting to learn about Addressables for some time, you explained it really nicely, thank you.
I bought the Full Course. Thank you for this incredible resource!
Thanks! Make sure to check all the lectures, there's tons of obscure tools that Unity has, I hope you like it!
AMAZING TUTORIAL! I really need those cloud tutorials aswell I hope they're coming out soon :')
Another superb lesson. Can thoroughly recommend the full course!
Amazing, only problem is, if I end up bookmarking all your videos, bookmarks become meaningless, I think the thumbnail should be changed to Addressable. I might strugle to find this in the future because of the thumbnail
I dont know how you add so much detail in such short period of time, considering the rate at which you make content!
Keep it up
I just realized this is part of the course which I have purchased but I have not started yet
This was a tough video to make a thumbnail for, I'm not sure most people know what is Addressables so I chose to use that in the title and focus on one of the main benefits for the thumbnail. So by the title it should be searchable.
Hey I am from India 🇮🇳.
You are doing well job 👏👍.
I am watching your videos .
Make more and more videos for us. Thanks a lot.
Excellent tutorial. Waiting for part 2.
Excellent video. 😄👍🏻
This topic seems very important specially for mobile multiplayer games these days 🎮
Great Tutorial Big THX!
at 9:35, I notice that you magically pressed a short cut key to auto generate the AsyncOperationHandle_Completed event and its function. How did you do that?
It's just the Tab key
It's Visual Studio's default auto-completion, after you type += on an event if you press Tab it auto completes the event function. I don't think VS Code has it, at least not by default, I'm using VS Community
@@CodeMonkeyUnity ah... ok thx
I don't like that registering to the completed even occurs after the call to load the asset. In my eyes that is just bad flow, the completed event might fire before you get a chance to register for it. There might be some behind the scenes logic that the AsyncOperationHandle could check if its already completed when new subscriptions are assigned. However I still don't like how it looks in my code.
Good point
Since the whole system is asynchronous I don't think it's possible for the event to fire before you register it, I think even when loading a 1KB file it will take at least one Update to complete so I don't believe that's a problem.
Add UniTask to your project and it’s super clean again, no ugly callback/event stuff:
private async UniTask LoadAsync() {
var go = await Addressables.LoadAssetAsync(…);
Instantiate(go);
}
Ugly stuff is behind the scenes and we got a nice API. Also, UniTask is pretty much a standard Asset to use because all async/coroutine stuff is much better writeable and handleable :)
Amazing tutorial, detailed and easy to understand, thanks!!
I'm glad you liked it!
I understand Adressables thanks to this video. Thanks
Super Tutorial Thank you for this and the ones following up on this with the cloud tutorial.
Also just a request for maybe a async cloud based game in the future.
Thanks again. Amazing video. Helps us a lot currently
16:00 how you use label with string? is it same with AsyncOperationHandle asyncOperation = Addressables.LoadAssetAsync("Assets/_MS/Model/test.fbx"); but just label like ("environment")
Almost jelly how much faster you seem to learn newer unity concepts and absorb how they work. Oh and make a hey gang here's the whole thing dissected and explained..
Meanwhile I gotta watch your video 3 times along with a slew of support alternatives to have any level of a working grasp on some of these things at all
Sigh
if by "support alternatives" you mean checking out additional documentation, that's how you're supposed to be doing it to learn faster
Thank you, very helpful. I can see how this would be useful for managing things like weapons/armor/clothing that might change frequently on characters/NPCs.
One thing that's currently confusing me about Addressables is that using them seems to remove the usefulness of the editor? If all the assets need to be asynchronously loaded, what do you do during design time? For example, while creating your scene, and putting all the environment assets where you want them to be? If you make them addressables, you can't view them in the scene anymore, can you?
I’m thinking that too
I think it’s more for optimising and should be used after your scenes are complete. The whole point of addressables is to minimise ram usage by dynamically loading assets from the disk while the game is running. It has nothing to do with the editor.
Have to learn it, it gives massive optimization power 💯
Great video. Super helpful!
Thanks very good guide on addressables.
yes, more interesting. I am looking forward.
Amazing video 👏. Really helped me reduce my game size.
I also watched your video on unity gaming services so i wanted to ask :
Are you planning to make a video on how Cloud Content Delivery can be linked with addressables?
Yup I did cover cloud content delivery in another lecture on the full course
@@CodeMonkeyUnity i did see that now on your paid course, can you maybe post it on youtube too (as no one has properly covered it yet) or maybe just add a feature to just buy the particular video because i cannot really buy the entire course for one video.
Thanks for the reply.
Quick question.. Is it really a good practice having the whole scene as a prefab? Or was just an example? I don't know if addreassables support scenes directly or not, but for baking light and that stuff it would be important. Or is it more oriented to "simple" assets instead of something like a scene?.
Also, does it allow you to include new scripts with those packages? Or do you need a new build?
Thank you!
It was mainly just an example, depending on the size of your level you might be ok with making it a single prefab if it's relatively small but definitely don't make it a single prefab if you have something on the scale of Skyrim.
On a large world you would split it into chunks then use Addressables to dynamically load/unload them as the player moves to have no loading even in a huge world.
Addressables is only meant for assets, not code. You can reference scripts that were included in the build, but you cannot include extra code in the addressables that wasn't present in the original build.
@@CodeMonkeyUnity Got it! Thanks!
Really helpfull and professional content, I already learned a lot from yout channel!
Thanks a lot!
Would be great to see how to make a melee combat system with finalization and slow motion in the last hit on the enemies.
That was wholesome ❤
Thanks for this amazing tutorial
Great intro to Addressables! Can you kindly post the link to the next part which covers Remote Addressables? TIA!
This video is a sample from my Ultimate Unity Overview course, the other 2 lectures on Remote Addressables and Cloud Content Delivery are available on the course unitycodemonkey.com/courses.php?c=ultimateoverview
I would love it so much if you could make more tutorials about Netcode and multiplayer with unity game service! The first tutorial about Netcode was great, a full overview of Boss Room soon would be such an amazing gift for us ♥️♥️♥️
I've been using addressables for a while now. I wasn't aware that the addressables are built upon a unity build like in the video?
I always remember manually having to build addressables individually. What do I have to do to have this behaviour by default?
Very nice video by the way. Even if I already know how this all works, it's great to solidify my knowledge. I like how the video only used minimal code, as it's way too easy to overengineer with addressables while self-learning this like I did :)
There are both methods, I believe this behaviour is the default, I don't remember changing anything to make it build alongside the game build.
After making the build then there's another menu to update a previously created asset bundle, it's what I used in the Cloud Content Delivery lecture to update some assets on the server.
Thank you, amazing explanation.
Nice video 👍 thanks a lot for your help!
I'm asking this before watching, can addressables be good for let's say a battle pass in a game? Like load each tier as a scriptable object that you load in your game maybe? Thanks
Nice tutorial. Can you make more tutorial about download Addressables player content from cloud from initialization then load from local at runtime ? Thank you
If you use Addressables remote then you have that behaviour by default, the system is smart enough to first check for the hash on the remote server and only downloads all the data if the hash changed, if not then it uses the cached data
Hello CodeMonkey. I think the best idea for this thing position based addressables. Like if player close to assets load that if far unload. Can we make like this demo?
Hello @CodeMonkeyUnity,
How can I customize remote download URL async at runtime via script? For example, if my host require private authen token included in download URL.
Thank you
Thank you again for tutorial :)
I don't understand, Is Adressables is completely replaces the Asset bundles common flow in Unity? Or I still have to choose what approach to use - Asset Bundles or Adressables?
Addressables is a tool built on top of Asset Bundles. When you make a build the system will go through all the Addressables you set up and automatically create all the asset bundles
Is there any benefits compared to LoadFromFile besides not using a string?
That was Great Video and i have a question that can we load multiple Addressable Scenes at same time? and if we are loading whole scene from cloud how can we reload it in our game as it is'nt in our build settings so SceneManager.loadScene(0) will not work! waiting for Answer
Thx very much. Can I ask? I have sets of scenes with large maps, the unity project would have like 100GB if I have them all in one project. I used asset bundles and add the chosen maps to the project or to the build to keep it small. Can I use addressables to achieve similar result? It took quite long to load large map from asset bundle
Addressables is built on top of asset bundles so if you're already using that then this system won't make it any faster
I'm having an on my Quest app with addressable . My scene slows down when it is set as an addressable, and runs smoothly when loaded locally. I used Occlusion culling to get this fat scene to work smoothly at 90 FPS. Occlusion culling seems not working on Android addressable scenes could explain my problem.
Just curious. I love your videos, but how come you don't use the practice of using var myvar instead of AsyncOperationHandle myvar? I know this is a huge debate in the c# world. I prefer it over having to redefine the type in the event the assignment needs to change later due to requirements changing, and Ide's convert it at compile time anyway, so there really is no performance gain over one or the other.
I guess it’s up to personal preference. When I’m learning I use the full explicit version so I can remember all the names etc
@@blockify If you're coding on your own, it absolutely is up to personal preference. In a professional environment, you have to follow the code standards the company sets. companies are more often than not going with the "var" standard (It's even a highlighted nit in Rider), which is why I asked. Anyway, was just curious, not attempting to come down on anyone. :)
What video editing tool do you use? Maybe I want to create my own devlogs :)
I use Premiere for editing and OBS for recording, best of luck with your devlogs!
how can we add a loading bar 🙏🙏 to show that it is loading in background
I'm currently working on a project and I want to load the scenes remotely through addressables. I have a doubt ,after downloading the scene 1 from cloud in play mode, will that downloaded scene remains in the project or it has to be downloaded again after exiting from the playmode
Would love to see if/how this could be used for streaming large environments!!
love this video~
Thank you for the amazing explanation. btw Why did it take 2 seconds to load the level in Unity but 9 seconds in Build
It has to do with how Unity manages memory, it's not necessarily exactly the same everywhere
Thanks for the clarification much appreciated@@CodeMonkeyUnity
Hi CodeMonkey, please make more videos on multiplayer topics.
Sprite load is not working on builds :/ even tough implementation is perfect & works in PlayModeScript set to UserAssetDatabase but does not work in other play mode script or in real build
could you made a tutorial how to update addressable content without download new version from app store thanks
At 13:40 watching you create an event subscription without any way of unsubscribing makes me ill lol
You can store the AsyncOperation and unsubscribe but its unnecessary, the Complete callback will never be called twice
@@CodeMonkeyUnity An event subscription will keep an object from being garbage collected. Most memory leaks in C# come from creating an event subscription without unsubscribing later
can you please make video on Google Play asset delivery. Thanks in advance
Can you add links after every video from where you learn all the stuff, it would help us in searching our bugs, buz searching from google is skill too isn't it?.
How can i implement it in a open world game (should i?). like should i use box triggers at different place and load the near by terrains when player triggers it, or can i make some sort of world streaming system which would load and unload terrains when the player is colse ( im not really sure of the second method definitely need some insites on this.)
Yup if you have an open world game you should definitely implement some kind of world streaming system to keep your game performant. And yes you would basically split your world into multiple chunks, and load/unload chunks as the player moves through the world.
Just wondering with Asset Bundles you are able to create an asset Bundle in one project and then load them in a game built from a totally different project. Is that possible with Addressables or would you have to set up the addressables from the project that you are building your game with? Basically I'd love to have one project just for world building where the addressables would be created from, then other projects for Server, Client, Maybe a Game Editor, and maybe a Offline World Viewer or something like that and share the addressables between all the projects.
Hmm I haven't tried out that scenario but Addressables is built on top of Asset Bundles so if you can do that with Asset Bundles then it sounds like you would be able to build the same thing with Addressables
Why when you spawn the prefab for the scenario with the "T" key you do it as a transform instead of a gameobject?
Just personal preference, normally I like to work more with Transform than Game Object unitycodemonkey.com/video.php?v=B-dVf9wUEbg
Nice ❤ i play some games they’re disabled objects when player far from it and it enable it when it’s near like house when you far you can’t see but when you be close you see it is this system good? I am sorry my English not good 😅
Hmm sure you could load a simple Billboard when the player is far away and use Addressables to load the full object as the player moves closer, that would be a good use case.
Wow, fantastic tutorial. Super useful. I'm wondering how useful it'll be for me, as someone who makes relatively small 2d games.
same as you, I don't think it matters for small games even in 3d. If you build open world or big scenes maybe !
Depends on the scale of the game, Hollow Knight is a 2D game with a huge world that would definitely require memory management.
Can you make tutorials for UI Toolkit
Yup it's on my list but not sure when I'll be able to get to it
Apart from addressables' CDN feature, what's the difference between loading scenes (containing some parts of the game environment) additively and using addressables to load a group of the same game environment parts(labels)?
Functionally they would be similar, if you load a scene additively it has pretty much the same result as loading a giant prefab with addressables.
The main benefit is with addressables you have more control, you can make a single texture or mesh addressable, whereas with the scene method you'd need to place that object on a separate scene
Where is the second video (about loading Addressables from a server)?
It's a lecture in the course, there's one on Addressables Remote and one on Cloud Content Delivery
@@CodeMonkeyUnity I see thanks, and the course is not on youtube but is paid, right?
Yup correct, there are some free sample videos like this one here on RUclips but the full course has all 60+ lectures.
@@CodeMonkeyUnity ok understandable, though I found it confusing that you mentioned in the video that you will later describe remote uses of addressables without mentioning that this will happen in another, paid video
Besides that, this is clearly quality content
Hi !
Do you plan on making somes tutorial about FPS ? In mean by that, some kind of controller, shooting behaviours, recoil, reloading or any of theses subjects ?
Theses are just example but i think it would be great to have some kind of tutorial from.you on this very popular type of gameplay ! Thanks for Reading 😇
FPS is indeed a genre I'd like to cover, I haven't really made many videos on it, only made my FPS Microgame unitycodemonkey.com/video.php?v=twMkGTqyZvI
Although I did cover a bit of shooting logic in my Third Person Shooter, it's pretty much the same in first person, just different animations unitycodemonkey.com/video.php?v=FbM4CkqtOuA
very helpful video, but can i ask you this question, i'm referencing a prefab containing 200 sprites in my script, but why using Addressable still takes 5 seconds to finish loading that prefab, seems how Doing this still doesn't load faster than the normal reference way
Not sure what you mean, Addressables doesn't make loading faster, it simply gives you control over when you load the asset
@@CodeMonkeyUnity The issue is you titled your video "How to use Addressables FASTER Loading" etc. I came here looking to find a way around some of the slow addressable loading. What you meant is "load the initial scene faster", I suppose. Even though that's still a bit (unintentionally) misleading, since the scene isn't usable without the other stuff then getting loaded.
@CodeMonkeyUnity
Why doesn't my memory release after instantiating an object in Addressables prefab? It starts at 65MB, goes up to 150MB, but when released it only goes down to ~120MB instead of the original 65MB. Why?
It has to do with how Unity optimizes things in the background, not sure on the specifics but that's why the numbers never perfectly match.
Great video. Will this be useful for mobile games? What is the best way to do this when we are reloading the same scene again after a failure or something?
Yes mobile has much less memory than PC/Console so it's especially useful there, only load the objects that you need to and nothing else.
@@CodeMonkeyUnity what about reloading the same scene again? Is there a better way to do that? Or a different way to load and unload objects? Or is marking them inactive good enough?
@@CodeMonkeyUnity thanks for the tip BTW. Loved your video.
hey codemonkey I was wondering if you think this would be possible and if so where to look. I want to make a system like skyrim where entering a building takes you to an entirely different scene thats approximately the same size as the house. the problem is that I want to make a prefab of it so its scalable so if I place down another house prefab I don't want it to enter the interior of a different house. I want it to create its own instance of the interior especially if I want these houses to be generated procedurally. Is there a way to make these prefabs create a new generic interior scene(one I have premade but want to reuse for different building interiors). This question seems to be a little complicated to ask so I hope it makes sense.
Sure, sounds like you just need some kind of level editor so you can build a house interior with a bunch of modular parts, then save that level data somewhere, perhaps a scriptable object, and when entering the house ask the house object for the level data and load that level.
Alternatively if you don't want to do it through code you can place the house interior in a prefab then for each house object you attach a house script that has a reference to that prefab, you load the empty interior scene and spawn that prefab. Just assign different prefabs to different houses.
@@CodeMonkeyUnity thanks. I'll definitely look into the scriptable object idea.
Can we have the same benefit with async loading of a scene, what is the tradeoff , bigger exe size ?
Yup async loading a scene would work the same, the benefit of this system is you don't need to create an entire scene, you can individually load just a single prefab or texture or anything.
Hello, I just bought your couse on udemy but now I wonder whats the difference between the course on udemy and the content of your Yt channel ?
The course has all 50+ lectures, here on RUclips I only uploaded about 4 free samples.
For example this lecture on Addressables is a free sample exactly like the course lecture, but the following 2 lectures on addressables remote aren't available here on RUclips
@@CodeMonkeyUnity Alright, thanks for the answer and your amazing content =)
Just to mention, the half-way solution is to use resources, which can be loaded from disk when needed.
I still get invalid key with the labels way. How to fix this?
What's the purpose of groups though?
i got a question. why would someone choose this method instead of having multiple scenes and loading and unloading them respectively ? (watching the video , at least to my experience with mutiple scenes its the exact same functionality)
I personally would use it to store data in the cloud. You could add for example additional levels to your game without your users having to update it.
With this, you can micromanage assets of individual scenes too. That can give you extra performance boost. Also, main advantage of it is to store data in cloud and download new assets or update old assets without releasing new builds and also reducing the build size.
Sure, in terms of memory control both techniques can be used to similar results. I would say addressables is much easier to use if you have smaller use cases, like for example you want to load just one special enemy or a special sprite, with scene additive loading you would need to make a scene just for that enemy or sprite whereas here you just tick the box and mark it addressable.
And beyond memory management the other main purpose of addressables is downloading new content from the cloud, like updated assets for a special event, can't do that with just scene additive loading.
Ok thank you for the replies all. I believe I understand now.
Is addressables an option when using WebGL, because it doesn't like anything outside main thread?
I believe it does work in WebGL, asynchronous doesn't necessarily mean multi-threaded
Can someone explain to me why there is so much garbage still loaded after unloading addressables ?
In video at 24.39 Started project with ~136 mb of ram usage
at 24.52 code monkey has loaded addressables with enviro and ram usage jumped to ~616 mb
at 24.55 code monkey has unloaded addressables and ram usage lowered to ~ 257 mb.
There is still 120 mb of ram that was not unloaded. Can we do something about it ?
As far as I know Unity has various optimizations that will attempt to use as much memory as possible as long as the device still has memory, so in that case I assume it keeps some things cached just in case you want to load those same assets in the future, and it will only completely unload that memory if the device is nearing the limit.
@@CodeMonkeyUnity first of all thank you for anwser. Secondary I'm making R&D in this topic for my project with memory profiler and noticed some things related to my question that may help other users.
1) When you had empty scene you were not using almost any materials and assets. When you loaded enviro it loaded all assets related to this prefab. In it were for example elements with lit shader. Most people don't know but when you requesting material it is loading much more then just material and it shader. For example it needs to load "error" shader and create material instance of it to have chance to display it if something goes wrong. If you then unload your enviro it will not unload those "debug" shader and material. This case is not only for materials. Similar situation takes part in other object's type.
2) It is a bit follow up but it won't pile those "garbage" endlessly. If you Load Unload and repeat process you will not create additional garbage (at least amount will significantly lower).
3) It is a bit connected if you want to manage your memory by addressables scenes there are some ways but it is not so great ideea. There is UnloadSceneOptions.UnloadAllEmbeddedSceneObjects for additive scenes. You must know that even if you mark unload as UnloadSceneOptions.UnloadAllEmbeddedSceneObjects it will only unload all resources that are serialize in scene. So for example every object that you spawn dynamically will not be unloaded. You need to know as well something a bit obvious that when you are loading scene and any script on this scene that reference prefab or any other resources needs to be loaded with scene.
4) As CodeMonkey mentioned in comment above yes Unity has some build in solution to leave some elements not unloaded even when requested. It is kind of optimization that is great for 95% of use case but in other 5% is annoying as hell and there is no (at least known to me) way of disabling it.
Bonus : It is not mention in video but i think it is some great info. When you are loading addressables from label and in this label you've got different types of objects. I'm recommending to use Addressables.LoadResourceLocationsAsync(labelName) that has callback with AsyncOperationHandle asyncOperationHandle where you are dystyngiush type of object.
Hey bud, have you done a Net Code Tutorial using Visual Scripting?
if so, that would be grand
keep up the good work bud!
Visual Scripting has the same nodes as C# so all the functions you see in this video can be called from VS, just make sure you add the multiplayer assemblies and all the nodes will show up
@@CodeMonkeyUnity beauty, thanks bud. Yeah I got the nodes going and just playing around with setting up subgraphs and such to make it easy.
takes a while to translate from typed script to nodes, but totally doable.
I guess what I need is to start with a login screen,
most folks show how to setup the player object not so much how to setup the login screen.
hard to get good feedback to see what's going on you know? like how you use your console thing