Intro to Blueprints: Construction Script Customization | 08 | v4.8 Tutorial Series | Unreal Engine

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
greetings guys we are back and in the previous video we were working inside of our light blueprint and we set it up so that when the player approaches our light quick refresh your hair process our light our help text is appearing and it tells us to press F to toggle so we can press F and turn on our light press it again and turn it off if we turn it on and we exit our trigger volume or help text goes away and we can no longer press F to turn on or off our light because we are not close enough to it but we could turn it off as we get close to it again and because we're using class blueprints we were able to create a second instance of our little light setup here and this one just works automatically everything that we've done carries over to this instance as well so we can turn this one on or we can turn this one on or off and they work individually individually so that's what you did in the previous video we're going to take it a little bit further one step at a time continuing our baby step journey into blueprints in this video with the construction script and the construction script is going to allow us to add variants to each individual instance of our blueprint and what do I mean by that so say we have our two lights here suppose we wanted this light to be green and we want to dis light to be red or suppose we didn't want the text to appear when we enter the trigger volume etc how would we go about doing that because anytime we make a change to our blueprints so far it has been carried over to this instance of the blueprint of the other the other instance of this blueprint as well so how would we go about doing that well we're going to do that inside the construction script so let's go ahead and open up our light blueprint so I'm going to double click and open it up it's going to take us to the event graph which is where we provided all the script for the behavior of our light thus far but we're going to leave the event graph and we run hop over to the construction script going to click this tab in the center here and we get an entirely new graph with just one singular note on it and this is the construction script so everything that we've been doing so far on the event graph all that script kind of pertains to what happens in games so when you're in game the event graph is updating and checking things and making sure that your script is functioning as you set it up the construction script as the name kind of suggests is being used when you are constructing this blueprint when you are working with this blueprint when you are level designing and building out your levels the construction script is used to update the properties of your blueprint so anytime you make any changes to this blueprint if you move it inside the level if you change some of the properties of the light for example this construction script is going to fire to make sure that it has the most updated information about this blueprint so how can we use this to our advantage well what we're going to do is we're going to take our spotlight and kind of what we've been doing on the event graph here by getting a reference to our spotlight we're going to do that on the construction script and a little bit of a warning this is a little bit more of an advanced well not efficient in say advanced intermediate blueprint application here but we've kind of worked our way up to this point so I feel comfortable that you guys should be able to follow along and should have a lot of fun and make our light a little bit more customizable so we're going to continue we're going to march forward let's take our spotlight in our components here we're going to left-click and drag that into our graphs just left-click and drag it into our graph that's going to give us a getter so now that we have our spotlight we know that we want to be able to change the color of our spotlight so how can we do that well if we drag off of our pin here and we release we can search for color that's what we want to change so let's search for color and when we search for color you see we have the option to get light color so we can get the current color that's being used or we can set the light color so let's go ahead and choose set light color it's going to give us a new node connected to our spotlight and below our target here we have the option of adding a new light color so whatever we define as this new light color will be the color that is used for our spotlight you can see there's a little box here to the right of that we could actually click right here and define what that color will be right here inside of the color picker but we're going to do something a little bit more intermediate just so that we have some more flexibility with how our little light blueprint works here we're going to do is on this pin here we're going to right click on it it's going right click on it it's going to give us a little context menu there's two options here we're not going to worry about this bottom one here we're going to worry about this one right here at the top this is promote to variable so go ahead and choose this option and when we do it's going to give us a brand new node that is automatically connected to it and this node will hold the value of our new light color so I'm going to move it down here just a little bit under our spotlight like so just so it's a little bit cleaner and with this node send-up selected I'm going to go over to the details panel on the upper right up here we're going to rename this first of all because new var isn't very helpful to us we're just going to call this light color like so and if you look down in the default value section we currently can't set what this value is we need to compile before we do that so it says please compile this blueprint so let's go ahead and do that since it's trying to tell us to do so I'm going to go to the toolbar click compile and it's going to say that we are ready we are good to go as the tooltip suggests that might be must be that must be the most helpful tooltip ever we are good to go let's go over to the default value now we can now set what our default value is going to be so I'm going to click this bar here and we can choose a color in fact you know what we could do let's actually close this let's go to our spotlight and the components window over here and let's go to our light color that we had previously set so in the details panel here let's go and click this we're going to take our old color here that we had previously assigned or new because we're not going to change it here we can left-click let's drag that up to our color bar here like so just so that we have a reference to what that color was we don't need to hit OK or cancel here we can just close this now now we're going to select our light color node here and assign that value as our default value so let's click our color picker here there's our color let's go and select that and that's going to be our default value again so let's go ahead and hit okay like so and the last thing that we need to do is take our construction script here and connect it to set light color like so and let's move that down just a little bit so it is nice and clean so now we've used the construction script to set our light color but there's one more thing we need to do before we are done and ready to test this back in the details panel for our light color here let's go back to the details panel there's an option called editable and if you mouse over it it says whether this variable is publicly editable on instances of this blueprint this is what we want we want to check this let's go and check this and when we do so over on the far right over on our my blueprint panel here is our light color variable I guess I should have pointed this out earlier that got added when we created this anytime we create a variable it'll get added here in fact we could have created this light color right here from the variables section by clicking add and then over in the details panel changing it to a linear color like we did linear color like so and then we could have dragged this in plugged it in but it was much easier to just right-click on this and say promote to variable so that's why we did it that way but I guess I should have mentioned that it did get added to the my blueprint panel when we created that variable but back to our light color here on the far right we have this eye icon this eye icon lets us know that this variable is now publicly editable and we'll show you what this means in a moment but if we mouse over the eye icon it says variable is public but missing tooltip we can actually add a tool tip to this as well so if we go back to our details panel under editable there's an option for tooltip sense extra information about this variable shown when it is when the cursor is over it so let's add a tool tip and this is going to be to change the color of the light so change color of the light and we hit enter and when we do so our little eye icon over here is now happy it's green so let's go ahead and compile and save and when we compiled notice again our construction script fired and updated let's save this and let's go back to our level here so I'm going to go back to our level and when we play or actually before we play let's make some changes to our light so with our light selected in a level now if you look in the details panel we have a new property that we can adjust so here's our default light color for this particular light we can change this light color we could say let's make this one red like so we hit OK now when we select this instance over here it has its default value but we can change this one to a different color so we can click the color picker here we'll make this one green so and if we play now we go over to our light and we press F this one comes on as red we go to this one and we press F this one comes on as green so now we have some flexibility with how our blueprint class is functioning inside of our level so that is all fine and dandy we've pretty much accomplished what we've set after to do but there's one more thing that I kind of wanted to show you really quickly before we wrap this video up let's hop back to our level blueprint or excuse me not level blueprint but our light blueprint I'm going to undock this for just a second here but excuse me so if we select our light in the level and we wanted to change the light color it's really not very helpful for us as level designers to kind of change in tune and tweak to get the light value that we want because we're not seeing it reflected in real time we have to actually play and run over to our light and turn it on and see to see the effects of our change so I'm going to make one more change to this to make it easier for us as level designers to tune and tweak our lights inside of our level here so we're going to do back on our construction script here we move this over just a little bit we're going to take our spotlight here and we're going to drag off of it and before we have been using the toggle visibility to toggle our light on and off for debug purposes and for us to adjust this as level designer so I'm going to hold home and delete all that let's go for set visibility so we want to be able to set the visibility here so we're going to choose set visibility and that's going to give us a new node and there's a couple pins on here propagate to children etc we're not going to worry about propagate to children but the new visibility is whether or not this light should be on or off and that's that same property inside of our details panel here if I scroll down under the rendering section that's that property right here that we are going to be defining so how can we use this to help us in our level creation process let's go ahead and drag our set the visibility up and connect it to our light color like so so let me make sure let me maximize this so that you can see what we're doing here so make sure that our light color is connected to our set visibility and just as we did before with our light color we right click and created a property we're going to do the same thing for our new visibility so let's right click again on the new visibility pin and promote that to a variable and our node got kind of hidden up there so I'm just going to move it down just a little bit and we're going to rename this again just as we did before inside the details panel or and I call this we'll just call it the visibility settings abilities setting and we're going to make this publicly editable so that we can define whether our light is on or off inside of the level editor so I'm going to check this box here and let's add a tool tip just for the sake of being a good designer here so we're going to say turn on or off the light so with all of that let's compile and save and then let's close this blueprint and if we go back to our light in the level here inside the details panel we have another new property that we could play with and if we mouse over I guess I should have showed this earlier too we mouse over it says turn on or off the light it says change the color of the light so by default we could turn this light on inside of our level and that will allow us to now manipulate the color right here inside the level and we can kind of see what the light is going to be you can hit OK and change the color we can go over to this one here and select it and turn this one on and say that this one is now bluish color like so and because we're leaving let's leave this one back here checked so we're going to leave visibility set to on so this light will be on to by default now and whenever we enter this trigger will will press F and turn it off and then when we're in the trigger we can press on or press F turn on and off but by default it will now be on for this one we're going to uncheck the visibility setting and it's going to be off by default so it's going to be just like it was before but this one is now on by default so let's go ahead and play now and see what happens if we run over our light is off but our light on the backside there is currently on and it has a lovely shade of blue so we can go to this one we can press F to turn this one on and it's green and go to this one and press F to turn it off so there we go we've added the ability to kind of implement some tools for us as level designers to kind of modify our blueprints directly inside of the details panel right here inside of the level editor rather than opening up our blueprint class and making changes inside of our blueprint we've exposed variables for us to modify it directly inside of the level editor here so I just made our life a little bit easier so with that we are actually going to pause here this is going to do it for this video we've been working inside the construction script inside of our class blueprint here and we've made our life so much easier for modifying our blueprints inside of the construction script that's going to do it for this video we will see you in the video where we begin talking about the different workflows for creating class blueprints so far we have been creating a blueprint inside the content browser and then inside of the blueprint editor adding components and making modifications inside of our class blueprint in the next video we're going to talk about the different workflow where we can work inside of the level editor and add the components that we need inside of the level editor and then turn that into a blueprint as well just a different workflow that we're going to use to wrap up this series so that's going to do it for this video thank you guys for watching and we will see you in the next video
Info
Channel: Unreal Engine
Views: 84,684
Rating: undefined out of 5
Keywords: Unreal Engine, Epic Games, UE4, UDK, Unreal
Id: z1SD-d9yJmQ
Channel Id: undefined
Length: 15min 56sec (956 seconds)
Published: Fri Jul 31 2015
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.