hello and welcome to another tutorial in Wildlife this time we're going to be looking at the new UI layer system which has been added in the December 20123 build so let's just get started right away um if you look down here there's a new prop tab called your ey if you click on it we can see there's a few uh UI related props um now the first thing you always want to do if you do anything UI related is add a UI layer let's put one in here what this basically does is it allows all
of the children it has to be rendered to the screen you're also not limited to a single UI layer you can add as many as you want and this depth value controls in which order they should be rendered higher values means it's more in front of other custom uis that you have placed in the scene you've probably noticed that these green bars have appeared um they are the same as in normal props this uh yellow outline it just shows you which uh UI element is currently selected okay let's actually add something to the screen uh
let's start with a simple UI text um there's a new feature that you can just drag it directly onto an existing prop in the scene and it will set it as a child which is very convenient for UI related uh stuff um you can see the text is now also selected as we had before and it only selects um its actual size not the entire screen every time a bunch of new settings also appeared mainly the layout and render transform sections every one of these UI props will have these two sections um so let's go
over them if you've ever used the UI editor built into unreal engine this will seem very familiar to you it's a direct translation so if you used it you probably don't even need the step of the tutorial but uh for everyone who doesn't know the first thing we have is horizontal alignment that's just um how this object is aligned horizontally in its parent container the parent container is the UI layer so the entire screen so you can see if I move this around you can see it moves around on that Axis or the full width
same with the vertical alignment and of course we can mix and match them both together or put it in the center of the screen however we like the padding options tell the UI system how much space It should leave um on the respective sides so if we put this to say eight there'll be eight pixels of space before the actual element starts the same with the top and of course we can't see it because it's not aligned oh let's just quickly do that but uh it works in all directions it's even easier to see if
I put it on full you can see there's 8 pixel on this side 45 here 45 there and 101 down here so let's now have a look at the render transform section initially the position offset might seem like it does exactly the same as the padding except it's something that gets calculated after the UI has been layouted I'll just demonstrate by using something that I haven't explained yet I'll get to that don't worry if I add a horizontal box and add multiple texts you can see they're next to each other because they're in the horizontal
box if I change the padding everything gets pushed over whereas if I change the position offset it only changes that text after the fact that it already has been layouted the next few settings should be pretty self-explanatory um rotation well it changes the rotation of this UI widget um scale multiplier just scales it this is also um after it has been lay out it so if there was a text here and I scale it bigger the text the the text next to it wouldn't have been pushed it would remain where it was and we also
have a Shear setting that um will sort of skew the text in both um directions and yeah then it's just settings related to the text like font size um if it should be bold or not the color and of course what the text should be okay let's have a look at the next UI prop which is UI image um by default it's just a small white square you can um overwrite its width and height if you just need a color background for something you can use this um but you can also select a file on
your computer to have it displayed here for example I've just loaded in a picture of the Mona Lisa um and I checked preserve aspect ratio which um will have a different size as the image itself but it'll just try to have this um constraint to its actual aspect ratio so it's not stretched in any direction okay now let's have a look at these layouting containers um by default the UI layer acts almost identically to a UI overlay meaning if I add a text and another text they will all just overlap that one so if I
do this you can see it's not very nice if you want them to automatically align um beneath each other we can use the vertical box and every child of the vertical box will automatically try to well layout itself below the other one and it'll respect all of the sizes of whatever you did with them and all of the padding but you might also have noticed that a new size setting has appeared in the layout section this um tells the vertical box how it should be layouted inside of it alsoo just means it'll just put them
as close to each other as possible but if you select fill it will fill the entire space with that these are still all on auto so they will just uh cram themselves into the space that's um left um so for example if I select them all and put them onto fill you can see they're evenly spaced out now and this fill value just gives it some weight so if I select this um one in the middle and give it more weight then it'll have more space and of course it's almost identical uh in the horizontal
box except it's um horizontal mixing and matching them is also absolutely not a problem so I could have a horizontal box of multiple vertical boxes you can see they layouted um add a text to these add text to these add text to these and maybe add another horizontal box in this one add a few texts to that one horizontally absolutely no problem so the next one is the scroll box which works almost as the vertical BLX does except you can scroll through it so if we add a text you can also see the size isn't
there because it doesn't make sense because it's an infinite um amount of space technically so if we add a lot until it goes out of bounds here you can see it just stops there and we can just scroll up and down in this box and again the UI overlay works almost the same as the UI layer so it's this doesn't really make sense but it just puts them all in the same place the last kind of layout container is the floating window if we add it we get this cool well window um you can resize
it you can move it um you can add stuff to it which uh works the same way as vertical boxes do you can also close it which just makes it invisible but it also affects all of the child widgets it also contains a few settings like the width the height the position the POS uh of on both axes whether it's closable or not and of course the title now the next one is really cool if you want to build your own event system scenes or make custom editor windows it's a the button um if we
add it it'll look like nothing actually happened but that's because the button tries to take on the size of anything that's inside of it so if we add a text to it then you can see the button appears um the button has a color setting and of course all of the um events which are needed to make it work which is if it's clicked pressed released hovered and un hovered so clicked is down and up on the mouse pressed is only down release is only up hovered well if I hover over it and un hover
it when I un hover it and also here the button acts as an overlay so if I add m multiple text that stays on the same place if you want to have it a different way you need to add a vertical box yourself and then you can make a toall button with multiple texts uh the next one is a spacer which is just sort of an empty object so if I for example add a horizontal box add an image and want to constrain this image to only the middle third I can add two more spaces
in here also tell them to fill they all have the same fill value so they'll all be the same width and you can see the images the middle third and these are just sort of empty objects that um lay it out so the next five all have to do with getting an input from the user so let's start with the UI checkbox um it's a checkbox you can turn it on and off um and of course it has the corresponding events on value change and on value change no parameter so these are different in the
case that this will automatically put the state it's in so true or false in its parameter whereas this one you can put whatever you want into it um it of course has the option to be checked and it also has an optional option name what this does is you can see down here it could can add it with a semicolon in front of the true and false which is very useful if you want to use the set option value which always needs an option name and then the option value similarly the float field can be
used to input a value a floating point value so with decimal places it also has an unal change and unal change no parameter um of course it's not a bull so we have a value and we can also say uh Define a range so if we say it's from 50 to 50 it only goes between those values and it's exactly the same with the in field except it only uses whole numbers without decimal places the text field is very similar again it has the two events it has current text it has an option name but
it also has a type so by default um it's just a text box as you know it um but we can set it to multi-line which just gives it well multi-line support but then we also have material materal which gives you access to the material the custom materials so if you want a custom editor that you can just input a material and um apply to all of your props that you have selected this is a way to do it and you can just sort of select the ones that exist or edit them from here and
we have URL which gives you access to the file explorer so if you want a specific file or want to do a bulk import of something this is the way to do it and the last of the input Fields is the color field which um well it just has a color option name same events but it gives you a Color Picker and you can use the color for whatever purpose you need okay next we have a progress bar um it's just well a progress bar you can select what color the field color should be and
what the background color should be and it has a percentage value and last but not least we have the size box the size box has quite a few settings um if there're zero it means this setting is not being used currently so with override of zero doesn't mean it's zero pixels wide um we can test this by adding an image to it you can already see this is not 0 by0 even if we set it to use its full parent size um but if we set something like 100 by 100 the WID will try to
be exactly 100 by 100 pixels the Min desired width Max desired width Min desired height and Max desired height all have to do um with this object being inside a container that can somehow scale like a floating window or such um and it tells it to be able to scale but only stay within specific sizes so if we say a sort of a Min desde width of 100 and a Max desde width of 200 then it can scale between those values but if it get gets too small it'll stay at 100 and if it gets
too big it stays at 200 this of course only makes sense if the width override and height override are not set so if you want to use them make sure those are at zero the last last two settings of the size box are Min aspect ratio and Max aspect ratio which are which work the same way as the desired width and height um in that they try to stay in a specific aspect ratio so same width and height would be an aspect ratio of one um and depending on how they get Scaled in a scalable
container they'll try to stay within the Min and Max aspect ratios okay now that we went through all of these props here's just some extra useful information that might help you if you are stuck for example not every um UI object can support children for example an image cannot support a child it'll also tell you it'll tell you which uh valid parents uh exist uh so just keep that in mind because this cannot be rendered otherwise another useful thing to know which I forgot to talk about when I talked about the UI layer is it
has a visible and edit mode and visible in play mode um toggle so if you turn it off in play mode this would mean if I go back to play mode it wouldn't appear anymore let's just quickly try that if I add this text I can see the text and now it's gone now it's back or the other way around I can say I don't want to see it here but if I go into edit mode oh play mode sorry at the top left you can see the text and now it's gone again also in
this tutorial there were not many objects present here at any time so it was pretty easy to get around the scene but if you have a scene that looks more like this it's of course hard to find a specific element you want to edit that's where UI edit mode comes in handy if you click on it you can see you can just click on any of these objects and it'll select them in the um outliner this also prevents any clicks so these are buttons for example but clicking them doesn't actually activate the button it just
selects the object so if I want to change this text I can just click on it change whatever I want or if I want to add an event to this button it's very easy or if I want to delete a whole section or yeah this very easy one last little thing in edit mode of course it's easy to press buttons because you have a mouse cursor but in play mode you don't so how do we fix this well the player manager has a new event called set mouse cursor visible I've set it up um with
an event called mouse visibility and this lever sets it to true or false depending on if it's on or off so let's see if I flick the lever I have my mouse cursor I can still right click to rotate the camera but I have the mouse Cur I can click in everything I can still play and if I want to lock the mouse again I just flick the lever again and it's back to normal anyway that's about all I hope that was helpful if you have questions of course feel free to ask them in the
comments or in our Discord server and until next time goodbye