Unreal Engine 5 - World Partition: Loading/Unloading Data Layers

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
all right guys i'm back with another video so i'm going to go ahead and show you all how to uh set up lighting systems on data layers uh with world partition how to uh activate and deactivate those layers so let's get started first off i'm just going to show you all how i did it on this one so if i go to the level blueprint then we'll see that right here on this function uh i stored this on the game instance you could do this on the game instance and call it from the level blueprint all of this logic or you could probably just do it like this i probably should have done it all in one place but this is how i did it at the time so if we come over here i'm just i just got two variables of a type actor data layer and i have my data layers right here that i can select this is just given at the end data layer also you can drag out here and promote the variable uh to create those variables so that you don't have to do them manually you have to get the data layer subsystem and you have to set the data layer runtime state for each of those and the data layer subsystem is your target and you have to set them to activated or unloaded loaded may have worked i am not an expert on this i just figured this out on my own so there's not a lot of information out there and it was requested that i do this so here i am i'm doing it so right here i'm just calling the spotlights and i'm turning them off for all the spotlights if it's daytime if it's not daytime then it's night time and i'm turning them back on so over here under our data layers and if you want if you don't have that and you probably won't because it's not it doesn't open by default you should be able to go over here to let's see world partition data layers outliner that's where you'll get that from uh yours will be empty you'll create a new data layer by right clicking in this empty space and you'll name it and you can create a new data layer under that data layer if you want multiple data layers you can trigger them together i only had one lighting scenarios and what you do to add something to a data layer you just select it and you go to your outliner and you select whatever it is that you want to add to it let's say i wanted to add this building component here to it so that it gets loaded and unloaded with it with that selected i'll right click on that data layer and i'll add selected actors to selected data layers so if you add selected actors to new data layer it will create a new data layer for you and then you'll have to rename it you can also use this to remove selected actors from selected data layers so if you want to remove something that's how you do it so if you want to disable or unload one of these you just uncheck it and you'll see that it unloads it also you can hide it if you don't want to unload it and you need is initially visible is initially loaded is run time and then you have to set your runtime state is it gonna start unloaded loaded or activated uh honestly i'm not real sure what the difference is between unloaded and loaded i'm assuming that uh loaded means that it'll take up memory uh which but it'll mean that it'll be easier to and quicker to load in so it might be the case that in some instances you may want to have it loaded and then you can just activate it or if you don't want to have it taken up memory you could have it in an unloaded state and then maybe you'll load it but then you won't activate it and then maybe you'll after a timer it maybe you'll activate it okay so i'm just theorizing here i'll take that with a grain of salt again there's still a little information on this stuff here but we could uh hover over this and press uh f1 and it'll take you uh to this right here and it doesn't actually seem to take you to the right place sometimes it does sometimes it doesn't and the next update they might have that fixed but if we come over here to data layers it'll give you more information on these states so seven determines whether a data layer with the is dynamically loaded flag enabled should be uh loaded unloaded or activated at run time so as you can see here they don't actually explain what uh the differences between those it's very vague you know they uh if you're familiar with this they tend to explain things with an explanation of things okay like uh vector transform transform something would be the description uh that's about the what you can expect from their documentation so until further videos are uh come out or i have had a time or a chance to explore this further uh that's my explanation so with that out of the way uh also the more i become familiar with this uh the more i'll know and when i do know that for sure i'll do an updated video on it so um [Music] give me a second i'm pulling slack in my cord i have my mic right in front of my face so that you can hear me best uh so in a new project what you're gonna do is you're gonna go to file new level you can go to open world and you can create it that way and start with their open world or you can use whatever level you're in right now and you can go to tools and you can go to uh let's see yes tools it's un under here some more convert level right under your underworld partition so convert level uh you have to select your level i'll open it map is already used using world partition is it oh no this okay that's a different level let's just open this level and see what's in here okay so it looks like i may have already started one let's see this is the one we were in so i'll go to tools convert level i'll go to that folder and i'll select it i'll say in place if you don't check in place it'll make a duplicate of it uh in fact i'll go ahead and say not in place if you do do it in place then it'll reload this level after it's converted it i'm not going to go into details on the rest of this because i'm not real familiar with it i'm not real sure what only merged sub-levels means but normally if in the old version of uh not world partition but let's see [Music] world composition uh you had to have a folder with sub levels in it and i believe that's what it's referring to so i'll go ahead and do that again in place uh no let's do it let's not do it in place so i can show you what it does and then it's converting more uh map uh there it is it's complete you'll get something like this um you just press okay and you'll be loaded into that level you'll look around and you'll say okay where is everything at okay uh don't panic go to world uh world partition right here if you don't have that window go to window world partition and world partition editor that'll bring up this so with that you'll drag and drop over everything and just load selected cells so if you have a really large world you you're not going to want to load in the entire world because it'll slow the editor down uh that's one of the cool features about this you only have to load in what you're using it makes the engine very uh very efficient at working with large worlds so you'll see now i have this loaded in and so let's go ahead and get started i'm going to come over here to the lights i'm just going to select all of these and i'm going to go to data layers and it looks like they have one called cube i'm going to create a new one i'm going to call it lighting and also uh [Music] creating layers like this allows you to like say if you want all the layers under this unloaded you can unload lighting the lighting layer or you could individually load in the layers under that lighting layer so i'm just going to say day i want to right click and add selected actors to the selected data layer it'll turn blue meaning that this is the active one and you have stuff under it that's loaded if you unload it it'll ask you to save it first and you'll see that the lighting is now gone also if you unload the parent it does the same thing so let's go ahead and go into advanced we'll make this is run time and i'll go ahead and leave it in an unloaded state so let's go to [Music] the you know what let's come over here to the content i'm going to add add feature i'm just going to add the third person project to it and then i'm going to drag this guy out here um actually let's just not add that we'll go into the world settings and we'll change this to the bp third person game mode and now when i start you'll see i am occupying that character and i'm standing on that platform you don't see the lighting right now because i i have it initially unloaded but what we'll do is we'll uh go into the world settings we'll open this up and you should see the player controller class you could do this in the blueprint third person as well um actually we're going to do it in in the the third person blueprint since they're the player controller is the engine one so let's just say f key and you'll see f key right here and i'm gonna get the data layers get data layer subsystem and let's see we'll come down here so you have all these you get data layer you can set data layer runtime state by label or [Music] by state i'm just going to do it this way we're going to set that to activated and i'm going to promote this to variable i'm going to compile this and i'm going to set this to the day and actually let's do it like this we'll drag this out and we'll copy and paste this and we'll set it to unloaded and i'll do a flip-flop flip-flop is just like uh it alternates every other time it'll choose a different one a different branch so i don't know what n is cursive is recursive is for i have yet to figure that out but you'll see when i press f now it loads and unloads that data layer so back over here we can decide maybe we want to add this uh stuff here to a data layer so we'll select all of that and we will create a new data layer and i'll just call it objects and i'll add the selected actors to it and you'll see now and we'll make it run time and i'll just choose loaded just to show you that it'll be loaded but it won't be visible and this time i'll use the e key [Music] it doesn't always work uh if you say e key sometimes if you say key e keyboard e uh g yeah so it does it on that but if it's e it's probably not gonna pull up so i'll do the same thing here that i did on this one i'll just copy and paste that but for this one i'm going to make a new data layer and i'll call this objects data layer so as you've noticed you can call the data layer subsystem from anywhere which is really cool so will just start this data layer off unloaded oh wait no i was going to show you the loaded yeah that's fine okay and i'll press uh f and you'll see that's uh it's not loaded in but if i press e okay if i press e it's not happening so all right so after some debugging i figured it out so it's kind of weird and i'm not real sure exactly why i have to do it this way to get this to load and unload but i'll go ahead and show you how i did it so if you look uh i put the objects under a parent object i have them activated but i have the parent object unloaded i could probably also do it like this yeah even if they're loaded it'll activate them and it works now this n is n is recursive might bring this down to the children uh okay so see now because it's under one that's under that's in a run time state uh you can't uncheck runtime state which makes sense so let's just say unloaded it still loads them so if i come over here and i uncheck this it may not load them let's see no it does not okay so now we know what and i know uh what in is recursive means that means that it's going to branch down to the children and it's going to activate those as well so if you're wanting to load objects in and out it can't be on on a parent on an outside branch it needs to be a child of one and then you have to load and unload that parent to load in the children and if you want that to be recursive if you want this to branch down to the the children or include all the children then you need to have n is recursive set so let's try this real quick let's say i don't do that let's say if it let's see if it'll work now so if i just uh duplicate this and i'm actually just trying to figure this out on the fly guys so uh i guess i'm not doing a very bad job either this may not work it works okay so uh so we learned uh several things so let's go ahead and recap to create a data layer you have to right click create new data layer to add objects to a data layer you right click or you have to select the object first and you have to right click and add selected actors to select a data layer if it's it seems that to load and unload things from a data layer they have to be children of a parent and it doesn't matter if that parent is run time or not so in this case i because of the way i did this it worked but if you look at it and and i and i figured that out by accident uh if you look at it this one is in a runtime state but this one isn't this one isn't a runtime state but this one isn't so if i uh check uncheck this and come back over here this should work so let's just compile this and remember it wasn't working before now it's working okay so the thing to note here is that if you're going to load and unload these during runtime they have to be a child of they have to be a child so they can't be a parent data layer they can't be an outside one those you can't seem to if they have like whatever is on them you can't seem to load or unload them during run time i don't know if it was like that by design or if that's a bug that'll get fixed later but that seems to be the case as you've seen i can load and unload these parents and it'll load and unload everything under them if we have is in recursive checked if we don't it'll only load that parent object and nothing under it but then you can load those child objects after the parent object is loaded so that does work also you don't need to unload and load the parent and it doesn't really seem to matter if it's unloaded or loaded the only difference i can think of between these is unloaded means that it's not memory loaded means that it's in memory okay in memory but not visible and then activated so these two right here are for the editor only they're only for uh you right here uh this under advanced is for runtime so you can change the debug color if you wanted to i don't really think that's important but anyway that's pretty much all i got guys so i hope you found this helpful and i'll see in the next video
Info
Channel: Unreal DevOP
Views: 9,834
Rating: undefined out of 5
Keywords:
Id: zMnNeBa91Ow
Channel Id: undefined
Length: 24min 1sec (1441 seconds)
Published: Tue Sep 06 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.