Programming Concepts – #3 Unreal Engine 4 Blueprints Tutorial Series

goto afternoon ladies and gentlemen your boy over to see Adam welcome back to my Unreal Engine 4 advanced blueprint series in today's video we are going to be taking a look at some programming concepts and how we can use them to apply to our learning for blueprints now blueprints is a programming language just like any other and it's going to work in a similar way what I mean by that if you take a look at this little diagram that I've made here it's gonna help you understand blueprints and also how you can understand programming because they work together so essentially starting off from the beginning you are going to have three main parts of your programming this is the standard for a normal object oriented programming language inside of there you are going to have your events and then you're gonna have your actions and you're going to have your objects so the way that this works is it's an object-oriented programming language you have your objects an example of an object would be things like a point light a static mesh a matinee actor and other components within your level or within your game going on from there you are going to have your actions these are essentially things that you can apply to your object to make a change or to add the functionality of your game so for example let's say you're working with a point light as your object you could then change the visibility of that using an action and those two objects or sorry the objects in the action are then going to be linked by a target pin which is so that is what links it up so the object is the point light and then from there you are applying an action which can be toggle visibility or anything else that you decide and you can see underneath these we've got a couple of examples so you might want to toggle the visibility of the lights you might want to destroy the light so it disappears completely you might even want to change the scale it's entirely up to you but for these things to apply and to actually change objects you need an event and now these events are going to be something that's going to fire off a sequence of code and there's all kinds of different events inside of Unreal Engine 4 all of which you're going to get to know as you go through everything so an event an example of that would be begin play which is when the player first loads the level what it's going to do is if you have your begin play hooked up to one of your actions and your objects as soon as begin play fires off which is the beginning of the level it's going to apply the action which then feeds onto the objects and you've got all kinds of different examples and we are going to go over those as we get into the series so what I'm going to do is try and replicate this inside of Unreal Engine 4 using a point light so you understand how all of this works and what we're gonna do is use a begin play event to toggle the visibility of a point light so jumping into Unreal Engine 4 what I'm gonna do then is I'm going to drag a point light into my scene and I am just going to place it in here inside of my example map and just so that we can see this a little bit better I'm going to go into my details panel with this point light selected and just make it a nice little red and turn the intensity up just like that now if you guys want to learn how point lights or the engine works in general I definitely advise you check out my other series such as my level design series you can find the link for that in the description of this video so anyway moving on let's go ahead and bring this into our level blueprint hopefully from the last video you do have a solid understanding of the difference between a blueprint class and the level blueprint the level blueprint allows you to change the code specifically for the current level so I'm going to open this up because the point light is in here so we've got our main interface here and in my event graph what I need to do then to try and replicate what I've mentioned here which is turning on the visibility or off the visibility of the point light I need to vast things first get the event and the event that I'm after is called begin place all I've got to do to get that is just right click and type in begin play and you're going to notice we get to that or alternatively another way that we can get to this is just right click and then if we scroll down we've got our events inside of here and you can find them in the little various folders but that's entirely up to you personally I like to just type them in is the quickest way to do it so with this now then what I'm going to do is drag out from the execution pin and with this I'm going to click and drag to place it where I need to and then release it and from there I can apply an action from this event and the action I'm after is called toggle visibility so if I type in visibility I should be able to find that if not I can just right click type in visibility so if I type in visibility I should be able to find this at the moment I can't find it and the reason why is because I haven't got the object so I need to select the object right-click and then what we need to do is type in toggle visibility if it's still not there that's fine we need to then create a reference to the point light so this is going to become your object and it's going to look like this and then with my point lights I can then toggle the visibility of the light component which is the one that I've got here which is point light component with this if I just move this and move this down what it's gonna do then if i hook up the execution pin to the action just like this what its gonna do is toggle the visibility of this point light component just like that so let's just go ahead and test this and before I can do anything I actually need to compile this so just press compile in the top left-hand corner here so that it just runs our code make sure it's all good with this I'm gonna close my level blueprint and you can see by default the visibility of this light is currently set to true so you should be able to see it so having said that if I press play it should automatically as soon as I press begin play disappear so what I want to do is quickly make a change to my level blueprint so you can actually see this and what I'm gonna do is open up my level blueprint and after begin play I am going to drag out and I'm going to add a delay node so instead of going straight away on begin play it's going to wait a little bit of time and then change the visibility just make sure your execution pin is hooks up to this and from this to this and it's still going to apply the action to the object so the duration the delay I'm gonna make it wait three seconds so now if we compile press play you can see that we've got it on after three seconds it's going to switch us off so hopefully you guys are getting a better understanding of blueprints and I'm actually going to wrap up the video here if you do have any questions or anything like that feel free to EVG join our discord or just leave a comment in the comment section below once again guys thanks for watching stay awesome keep creating your boy virtus signing out this video was made possible by my supporters on patreon if you want more videos like this check out my patreon page using the link in the description to stay up to date on new releases make sure you follow us on social media

Tags: , , , , , , , , , , , , , , , , , , , , , , , , , ,


Leave a Reply

Your email address will not be published. Required fields are marked *