Unreal Engine 5 Blueprint Tutorial for Beginners

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey there dev squad today we're going to be getting started with blueprints in unreal engine 5. [Music] blueprints is an incredibly powerful tool allowing you to use visual scripting to create the gameplay and systems for your video games and this is going to be something that we can use instead of c plus which is the traditional use and also has a really steep learning curve this is something which is going to be incredibly important as it gives game designers and artists the ability to start working on systems and gameplay mechanics for themselves throughout this video we're going to be going over an introduction to what blueprints is how it works and most importantly showing you the different places that you can use blueprints and how you can get started writing your very first scripts using blueprints we'll be getting started in just a moment but first i wanted to talk about where exactly blueprint is used blueprints is typically used to prototype a video game the reason for this is because with blueprints you are going to be able to very quickly iterate on gameplay mechanics feel out game feel make changes on the fly most importantly you can iterate and you can do it very very quickly now blueprints can be used to make entire games but in a traditional workflow you're going to be building the prototype of the game in blueprints to very quickly spin something up and then convert it over to c plus plus and the reason why you would convert this to c plus plus later on is because c plus plus is going to give you more power it's going to be more efficient now that doesn't mean to say you have to do this conversion you do not have to convert your game to c plus a lot of small teams they go straight out of the bat and they release their game made entirely with blueprints and that's perfect for a small team built of artists however if you do have a larger team then making that conversion is going to bring a whole bunch of benefits in addition to this blueprint is something which is going to be used in pretty much all games either way the reason for that your user interface your artificial intelligence all of that is going to be powered by blueprints and traditionally you just wouldn't do that in c plus just because of how very quick and easy it is to get those elements working with it not only that unreal engine has really great support when it comes to ai and ui using these blueprints even better than that of c plus if you'd like to learn a little bit more about ai and ui then be sure to go ahead and check out our other videos on this channel don't forget to go ahead and subscribe if you want to see those for now though let's go ahead and dive into using blueprints okay so now that we've got unreal engine 5 open what i wanted to do was start off by showing you a blueprint that i created earlier so i can start explaining the fundamental principles of how blueprint works inside of unreal engine and what i've done is created a very very simple blueprint actor now this blueprint actor is really straightforward a blueprint actor is essentially going to be a type of class within your unreal engine project that is going to be built up of components and also code so inside of this blueprint we can see we've got components listed on the left hand side such as our cube and then i can see all of those components in a physical view in my viewport i can also go over to the event graph and start seeing all of the code that i have written inside of this and the code that i've got here is very very straightforward and this is essentially what we're going to be building today making sure we understand the flow and everything that is going to be sort of making this up so first things first we have got our event graph here and i can move around this as i need to the first thing we have got is an event an event is something that i'm just going to be referencing as a trigger an event is going to be something that happens and from that event what i can then do is start executing code so from my event here i can follow the execution pin and all of these lines that i've got here and it is going to fire off all of these different pieces of script in order so our event here is something that's going to happen when we begin overlapping and the other actor for that is our character so when the character starts overlapping this actor blueprint it is then going to be running all of this code the first bit of code we've got here is it is going to be spawning an emitter at a location and the emitter type is going to be an explosion and we're simply just using a little function here to get an actor location a function is just a little bit of code which is going to result in some more code but we'll touch up on that later on so we're doing that once it's done that it's then going to try and spawn a sound effect using more information that has been put into here and then lastly it is going to be telling it to destroy itself which is awesome now one other thing that i wanted to explain inside of here is so we've got all of these functions here so spawn sound spawn emitter destroy actor all of these functions are actually asking for information and we can see this with the different colored pins that we've got here all of these pins are something called a variable a variable is just simply a type of data so that could be location data that could be rotation data scale data sound data it could be absolutely anything and as we go through this blueprint course we're going to be working with lots of different data types that data types could be things like just simply values true or false it could be numbers it could even be components it could be textures it could be absolutely anything so hopefully that gives you a little bit of an intro as to how blueprints is going to work so logically what i can do now is go ahead and compile this close this blueprint and i can test this and i have put this test blueprint into my level here and if i was to then go ahead and run up to this it should in theory start activating all of the code that i told it to so if i run up to this you are going to see it is going to explode play the sound effect and then it is going to destroy itself and i've got another one over here and it is going to do the same thing so let's go ahead and take a look at how we can actually go ahead and create this for ourselves so doing this is really straightforward and you're going to learn a lot as you go through this first blueprint creation of your own so what i'm going to do is right click anywhere in my content browser and i'm going to create myself a new blueprint actor and i'm going to go ahead and click this and i'm going to be using the type actor now when it comes to blueprints you can have lots of different types of blueprint you can have things like game modes player controllers that all have different purposes for example a character is going to be a type of blueprint that can run around and move and accept inputs whereas an actor is very very straightforward it's going to have components and you're going to be able to start writing some code around that so let's go ahead and create this blueprint actor and i'm going to be giving this the name exploding underscore cube and then once i've done that i'm going to press enter and we can double click on this to open it up and test it and once you've done that you're going to be taken into our blueprint actor interface here and this is really straightforward and no matter where you're building your blueprint you're going to have a very similar experience we have got our components in the top left hand corner here and these are all going to be listed we've then got all of our functions macros and variables on the left hand side again we're going to be going into those in a little bit more information later on in this course we've then got the viewport which is going to let us see a physical representation of all of these components within this blueprint actor and we've also got the event graph which is going to allow us to see all of the code within this blueprint actor so this is where you're going to be doing all of your scripting you've then also got a bunch of blueprint properties on the right hand side that you can go into again we're going to be touching up on those as we go through this blueprint course what we want to do for now is we want to start building the components which are going to be the objects that we can start working with so to do that i'm actually going to go over to my viewport and i'm going to go to add and i'm going to add myself a simple little cube into this and as you can see here now in my viewport i've got a cube i could set a name for this if i wanted to and what i can also do on the right hand side in the details panel is i can start changing things like the static mesh or the material or even some physics settings if that's something that i wanted to do so all of our components are basically just objects just like any other object oriented programming sort of language or solution that you're working with and then with that object i've then got all of my properties on the right hand side that i might need to change and i can change all of these with code if that's something that i wanted to do but for now what i want to do is i actually want to take this component and i want to bring it into my event graph so what i'm going to do is go into my event graph take a look at all of my events now the only one we're going to be working with right now is our event begin overlap this is a trigger which is going to fire off your code when you start beginning to overlap with another actor in our case our character we've also got our event tick which is going to activate your code every single frame we have got your event begin play which is going to effect activate your code once you begin playing that level it's just going to activate it once and it's the same for the begin overlap each time you begin overlapping it's going to activate this code and fire it off the once so let's go ahead and take our trigger over here that we've got and with this what we're going to do is drag out from our other actor and we are going to cast to our first person character or whatever your character blueprint is now for me because i'm using the third sorry because i'm using the first person template that is going to be our first person character if you'd like to figure out what your current player character is that's really straightforward i can do this by going up to window opening up my world settings and then if i go to my game mode override expand this i can see my default pawn class that is going to be the one we are trying to communicate with because this is the one that's going to be moving around and potentially overlapping this object so i'm going to go ahead and go back into my blueprint here and what i'm going to do is notice it's already started to execute this cast to because it needs to communicate if i want to run more code after this all i need to do is take my execution pin here and i can start running code so if i drag out i could do something like spawn emitter at location and then what this is going to do is give us a function which is going to request some information and then use this function so the emitter template i'm going to use is p underscore explosion and then i'm also going to need to get a location so getting the location really straightforward what i can do is either use a vector value which is x y and z and with that the way i'm going to get this location is instead of hard coding it in manually putting it in what i'm going to do is i'm actually going to get the current location so type in get actor location and what this is going to do is this is another function it's going to ask for the target which is going to be this actor because we've set this to self and then it's going to give us a return value which is going to return that actor's location the target's location and it's just going to be dropped straight into our location here awesome if we go ahead and compile this code we can do this by pressing the button in the top left hand corner this is essentially just going to build all of our code make sure it's running make sure there's no errors and then what i can actually do is i can actually jump into this now and i can start playing this and i can start working with my code so what i'm going to do is i'm actually just going to very quickly delete my other actors in the level here and using the exploding cube that i've just created i'm going to drag and drop this into my level here and now if i go ahead and press play what i can do is find this cube run over it and as you saw there it is going to explode which is perfect so we know that our code is working if you're not able to overlap this cube for whatever reason and activate your code what you might need to do is simply click your cube and make sure that your collision preset for your cube is set to overlap all so going back to our event graph now that we know our code is actually working what i'm going to do is just start firing off some more functions functions being things that do things or little groups of code that do things so the next function i'm going to use is spawn sound 2d and what this is going to do is simply spawn in a sound and the way i did that was very simple i just took this execution pin here and i did spawn sound and as you can see here now we're actually starting to build our lines of code just in the same way you would with traditional programming it goes down a line by line this is just going to be following these lines here built up with our execution pins so what i'm going to do is put in a variable here for my sound for my explosion so i'm going to put that in and now if i go ahead and compile this and press play it is going to run over it and it is going to explode so it's going to pay the play the particle system and then it's also going to play the sound too perfect so let's go ahead and do something a little bit more to this what we could do next is we could actually go ahead and destroy this actor if we wanted to and by destroying this actor we've got our target to self which means this whole blueprint and if we go ahead and hit compile and hit play we can run over this and it's going to disappear all at the same time which is awesome so hopefully that's a really good intro to how you can start working with blueprints inside of unreal engine now with that being said one thing i do want to mention is that your blueprints aren't necessarily just going to come in the form of an actor the actor there really straightforward really easy to work with because all of the components are built within that actor you can also have something which is called a level blueprint a level blueprint can be accessed by going to blueprints and then level blueprint a level blueprint is essentially going to be where all of your components that you're referencing are going to be stored within your level whereas with a blueprint actor they're all stored within that actor so your level blueprints all of your code for that is only going to work in the level because all the components are within there if you were to change the level that level blueprint just would not be able to run so level blueprints can be really great because you can very quickly access information and objects and components that are within your level for example for creating things like escalators that go up and down or creating uh sound effects that fire off when you walk over them those are really really good and very quick and easy to do with our level blueprints so let's go ahead and build a very quick level blueprint as well for this level blueprint i'm going to have a trigger volume in my level and once you walk over this we are simply just going to turn a light on really really straightforward and really easy to do so what i'm going to do is i'm actually going to first and first things first create myself a point light by going to create lights and point lights i'm going to drop it into my scene here and then in the details panel i'm going to set the intensity of this up nice and bright to a value like 100 then i'm going to set the color to blue and then from this what i'm going to do is go down and set this to invisible because i don't want this to be on by default now with that done i'm then going to create some kind of trigger and i'm going to do this by going to volumes and then trigger volume and what i'm going to do is just place this trigger volume just in front of my three cubes here now we have got some components to work with let's make it so when you walk over this trigger volume that light turns on to do that let's go into our level blueprint and then what we're going to do is we're actually going to select this trigger volume and we are going to add an event for that and we are going to be using a collision event and that is going to be add on actor begin overlap so when we begin overlapping with that trigger volume we can start executing our code so this is going to run in a very similar way to the blueprint that we created earlier our other actor is something we need to put in so again we are going to cast to our first person character and then from here from the execution pin we can start running whatever code we like for me what i'm going to do is set the value of this light's visibility property to true to do that i'm actually going to need to select this light and get a reference to it so right click on this and get a reference to that point light and then from this reference what i can now start doing is setting the value of properties so you can see here there is lots and lots of different pieces that we could set so we could set things like the intensity or we could set the visibility we could set any one of these properties over here on the right hand side using blueprints so hopefully that gives you an idea of just how powerful this is we could change things like the texture of the light we could change things like the attenuation radius or how far that light travels there is lots and lots and as you start building gameplay mechanics you are going to see just how far you can push these components so the one we want to do is set visibility and that is for our light component and with this what we're going to do is again hook up our execution pin from our cast to this set visibility function and now it's asking for the data first piece of data here is our target which is our point light that we reference directly from the level and then propagate to children and undo visibility the only one we're going to worry about here is our new visibility and this is a boolean which is true or false so i can go ahead and set this to true because i want to make this visible now i can hit compile and then close this and press play and if i was to walk up to my three cubes over here as you can see now the light is going to turn on which is absolutely perfect that is some very simple blueprinting that we've done and there is a whole world more that you can do with blueprints you've got things like flow control to maybe let's say you only want this to turn on the once so we could do something like do once and then with that we can then sort of put that in there it's entirely up to you but for now what i want you to do is start experimenting with some different components start making some different behaviors with those components whether that be lights static meshes sounds have fun do that as an actor do it in your level create something fun and then we're going to be moving on to some really interesting stuff as we go through this course that concludes our blueprint demo for this video i hope you have enjoyed it and have a really solid understanding of how blueprints can be used in video game creation you should now be on your way to building your very own video game mechanics if you want to learn a little bit more about using blueprints make sure you go ahead and subscribe to our channel for more videos just like this if you want to take things one step further be sure to go ahead and check out some of our creator game series where we build video games from scratch using just blueprints examples of this are things like our fps or our rpg course i'd also like to take a moment to thank our patreons that made this video possible if you want to support more videos just like this be sure to go ahead and check out our patreon the links in the description down below that's everything for this video i hope you have enjoyed it stay awesome keep creating vertus signing out
Info
Channel: DevSquad
Views: 3,429
Rating: 4.9391637 out of 5
Keywords: unreal engine 5 tutorial, unreal engine 4 tutorial, unreal engine blueprints, devsquad academy, how to make video games, unreal engine 5, unreal engine 5 tutorial beginner, ue5 tutorial for beginners, unreal engine 5 beginner, ue4, ue5, how to make a game, blueprints tutorial
Id: ixR6T10l400
Channel Id: undefined
Length: 23min 41sec (1421 seconds)
Published: Sat Oct 02 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.