Unreal Engine 5 Tutorial - Level Instancing

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] hello everyone and welcome to another unreal engine 5 tutorial in this video we'll be covering a new feature part of unreal engine 5 called level instancing this is a new technique that we can bring in to use with a world partition system that is also new to under margin five so let's take a look so in unreal engine five level instances kind of replace what level streaming used to be and level instances are basically way to put levels inside of other levels and you can then code them to do stuff and makes you able to do like things called prefabs um a lot easier so here's an example using the infinity blade assets uh in this map we've got this statue and this fountain combined together like so um so i'm just going to select all of these pieces okay and then if i right click on them i'll see the option for level and you'll see the option for create level instance all right we'll talk about the pack level act in a second but let's just create a level instance and when you do that it's going to give you this box and this box is going to ask you basically where you want to set the pivot and how it's going to work so the pivot by default is going to be center minimum z so basically it will look at the height of it and look at the minimum height of it so the bottom it will aim for the center okay so in this instance it works quite well for this fountain but there may be an occasion where you want to say choose a particular actor in your selection that you want to use or use the world origin whatever it may be now one thing that's really useful about doing it this way is you can do prefabs where you can make buildings and houses out of pieces and then we rather than rebuild them over and over and over again you can just package them up into a level instance and then you can just reuse them as you wish so the way it works is once you've set up your pivot type you hit okay it allows you to save it i'll save it there and i've now got my fountain as a prefab and you'll see here on the right hand side an outliner level instance five and you'll see in here i've got these assets which i can't click on uh in this current state at least anyway but what it means is i can now make a duplicate of this really easily uh because it's just treated as one object basically um just drag out another one and another one and these are treated like separate levels um so you can actually go into these and edit them like levels um so if i were to open this up i'll just get that asset all on its own okay so it is just hard to see because there's no light but that's it that's all they are on their own so there are they are basically prefabs that you can place around in any way you like so let's go back to our previous level that we were in and go back to this one okay so there are my prefabs there now if i want to edit them or change anything about them be aware that if you change it and change one of them it will change all of them okay because they are just copies of each other but i'm going to show you some things around that in a minute but to edit them just right click on these and go level and go to edit you also have the option to break it apart as well so if you want to bring it break it apart into its individual components again you can do so by hitting the break button here but let's go to edit and it'll go to this view uh where you can then move things about do what you want with them i've moved up there and then when i'm happy with that i'm going to right click on it level and then go to commit and it will complete commit those changes and you'll see all the others i've updated this too so let's say you're building a city you built one building and you make one change you want to affect all the others you can just do that really easily with level instances but what if you want to be a bit cleverer than that okay so there is another option let me just take that out take this out and undo this and let's show the break uh level break break no instance and yep and you'll see it get broken into its individual parts again let me bring it down okay so the other option which i mentioned briefly before is the packed level actor so very similarly you're gonna get the same box come up hit okay it's gonna actually save the map and save it there let me ask you to say something else it'll ask you to save the blueprint of it so that's why it comes in as a blueprint so let's open this up so as you can see over here it's now a blueprint level instance rather than just a level instance with pieces in it so what makes this really easy is there is now a blueprint of it which i can just click and drag it out i can easily see what it is just by looking at the picture really simple and if i was to open this up you'll see it's already made them instant static meshes and put me inside the actor itself and what it'll do is automatically try and do this as cleanly as possible um so if it has a way to do instance ones it will do instance once if it's trying to do more hierarchical instance ones that you can do as well uh no matter what the case is it will try and do its best to make it as uh streamlined as possible but here it is in noise glory and again if you change anything here it will change it in all of them however because it is a blueprint we can add functionality to it do interesting things so let's say for example i wanted this asset at the top here this statue to change based upon an option i want to give it well what i can do is i can go to my construction script drag out this instance mesh and in here i'm going to do set static mesh and the new mesh we're going to do i'm going to drag out and promote that to a variable and let me delete the old one so here's the statue mesh and it's available and i'm going to take instance editable and and no not exposure just instant edible uh so that will change the mesh but i also have to change the materials as well so we'll do is take the instant static mesh and do set material and we're going to get material and plug that in now sometimes you might get ones that got multiple materials on them that's no problem either you can just do this instead where you get the mesh and you get materials and you get the static materials and then in here we're going to do a for each loop sorry like so and we'll drag out my instant static mesh and do set material and we'll plug in the array index into element index and then the material will be this array element split we break that apart and get material interface so now no matter how many materials the mesh that we give it has it'll match it perfectly because it's on the construction script i can easily test this inside of my game editor so let's go back to here and you can see they're all gone and that's because the default this is none i can put in anything i want in here so we've got um the angel angel statue in that one in this one we can say there is a uh statue oh i hope i can spell statue quickly um we'll go for that one and we can add another one in here and we'll go for this one okay so you can do interesting things with this uh system and so that's level instances and hopefully you can start seeing the benefit of what you can do with these things because we can make this blueprint do anything we like um but it's really useful for things like prefab so when building a town or a large urban environment buildings come to mind as a really easy simple way to make buildings using level instances and there we go we can now use level instances in our projects hopefully you can see some really cool uses for this including light crane prefabs and other instance assets like that where you can change one thing and make it affect it throughout the level so lots of really cool things you can do there if you like this video content and we'll see more of my content before anyone else head over to patreon.com forward slash ryan laylee where you can watch all my videos before anyone else from just one dollar a month massive thank you to all those who are supporting me and if you're watching this and not subscribed hit that little subscribe button and i'll see you all next time bye everyone [Music] you
Info
Channel: Ryan Laley
Views: 41,871
Rating: undefined out of 5
Keywords:
Id: MOIXPN_IUkw
Channel Id: undefined
Length: 9min 27sec (567 seconds)
Published: Fri Jul 29 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.