How To Optimize Your Levels In Unreal Engine 5 ( Level Streaming Tutorial )

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello in this video we're going to go over how you can optimize your under engine game projects by using level streaming level streaming is a technique that allows you to efficiently manage Levels by dynamically loading and unloading specific areas of our game World instead of loading everything at once unro engine allows us to only load the parts that we need how does it work in a nutshell imagine your game World divided into smaller manageable levels all of these levels exist in one main level and as the player basically navigates the game these levels are seamlessly loaded or unloaded in the background this not only conserves system resources but enhances performance by reducing memory usage and improving frame rates so with all that said let's get into the video to get started we're first going to create a main level and from this main level we're going to be able to load and unload all of the different levels inside of our game so if I just go file new level and I'm just going to set the basic level and then I'm just going to save this level somewhere in my um project I'll just call this The Hub level then you just want to go to window and select levels this will bring up um this levels tab here I just popped it in the corner here now to add levels to this Hub level we can just go here where it says levels and then go add existing so we can add existing levels into this level or we can create a new level I'm just going to create a new level so I'm going to go create new and I'm going to select empty so it will have nothing inside of it and go create and let's just call this um level one and I'll save that okay so in the bottom right corner you'll see it says level one this basically means I'm working in level one so if I just go here where it says quickly add things to the project and I added um a cube and I'm just going to um duplicate it and make another one all of these cubes are in level one if I just click this I icon you'll see um it's hidden so this persistent level is our main level and if I just click this I this is my level one to work in the persistent level I can just click here and now basically if I were to add a cube or create anything it would be in the persistent level if I change this to be level one then everything I create will be here in level one okay so I've just modified my own persistent level a bit I gave it some walls and I'm just going to change this back to level one and I'm just going to select all of these um three cubes and move them into the next room that I've placed here and what we're going to do is we're going to make it so we can dynamically load and unload level one so if I just click play in my game right now I'm not going to be able to see um those cubes because we start off in the persistent level which is the main level in order to see the cubes we need to load in level one so there are two different ways we can do this let's go over the first way the first way is by creating a volume if the player overlaps this volume it will load in level one and if the player leaves this volume then it will unload level one so to create this volume we can go here where it says quickly add things to the project then if we go to all classes and look for a level streaming volume so this one and just select it and just kind of expand it and when my player is basically in this volume it will load in level one so I've just wrapped this around the whole of this area then to basically trigger it we just want to go here and click this little pencil icon this will give us the level details and then we want to go to level one and then we want to go here where it says streaming volumes and go add array element and then we just want to select the level streaming volume okay so I got an error message saying cannot add level streaming volume which is not the persistent level so I can only add um this level streaming volume in the persistent level because the persistant level is going to be the um first level the player spawns in we can't basically load in a level streaming volume so I'm just going to select this copy it and delete it and then change this to be the persistent level and we want to place the um level streaming volume here in the persistent level okay now that I've done this if I go back to this um pencil icon I select level one and for the streaming volume let's select the level streaming volume close this go save so now I go play and let's say I enter this volume it should load in those cubes okay nice so as we can see when I entered that volume it loaded in um level one and I can see these Cubes but if say I were to um leave this volume then it will unload those cubes so here yeah roughly here is where I plac the volume so maybe in your game if there's like a door and once the player enters the door you can basically unload all the assets behind it that would be a way to use it and then I'll show you the other way which we can basically um load and unload levels for this method um I normally don't use both at the same time so I'm going to actually just delete this level stream volume cuz it can kind of conflict with the um second method that I'm about to show you so I'm just going to go here where these three level icons are and go open level blueprint and I'm just going to right click and look for the one key and the two key and basically when I press the one button I'm going to load in level one so to do this we can drag off press and I'm going to look for um load stream and we want load stream level by object reference I'm just doing this in a kind of quick way you could basically code it so when the player walks through a door or if they interact with some objects it does this but I'm just making it when the I presses the one key we're going to load stream level by object reference and I'm going to select level one and just make sure to check this make visible after load if you don't have this checked then you're not going to be able to see any of the objects okay and then I'm just going to drag off two when I press the two button I'm going to unload stream by level and we want buy object reference and I'm just going to select level one let's go compile and let's go play so I'm going to go into my room and when I press one it will load in um those cubes when I press two it will unload them so maybe like I said you can make that Dynamic so maybe when the player interacts with an object or does something you can make it load in a level or unload in a level and like I said at the start of the video this is just a much more optimized way to basically have all of the levels in your game because you don't need everything loaded in at once we can dynamically load in what we need and unload what we don't need so that's all for this video I hope you found this helpful and enjoyed it if you did make sure to like And subscribe and I'll see you guys in the next one bye
Info
Channel: Unreal University
Views: 19,554
Rating: undefined out of 5
Keywords: level streaming, optimize unreal engine, unreal engine 5 tutorial, level streaming unreal engine 5, how to optimize unreal engine 5, level streaming ue5, unreal university
Id: FWFk811_Ers
Channel Id: undefined
Length: 7min 27sec (447 seconds)
Published: Wed Nov 15 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.