Unreal Engine Blueprint Fundamentals | Class #1

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
foreign Welcome to our visual scripting crash course my name is Kevin I am currently a tech artist at riot games and I have been teaching various forms of scripting classes over the years over like the last 20 plus years and I I realized that there is a large portion of visual scripting that for people who have never had any kind of scripting classes or a programming background are potentially foreign the idea of for loops and nodes and execution orders and variables and all these things that honestly I think a lot of people take for granted who have have these backgrounds would be potentially beneficial for anybody who is for example a little bit more creative they just never had it this is the first time using Unreal it's the first time using a visual scripting language so that's what this class is about this class is hyper focused on visual scripting specifically in Unreal Engine in order to teach you the foundations that perhaps you're missing as a result of not having some of those backgrounds so that you can use that to leap off of and very just you know you'll just be more at ease with blueprints as a result of understanding everything that you're looking at now it seems like I think part of it is because it's visual scripting it seems like it's going to be easy or it is easy and I think it is easier but when I sat down to make this first class it was daunting trying to figure out how to even focus on the fundamentals of visual scripting with all the information that is being thrown at you and unreal because the program is so deep I've spent a lot of time trying to figure it out and I'm kind of done with it we're just gonna roll we're just gonna throw caution in the wind and hop in so this class is very much a work in progress as we proceed don't hesitate to throw in comments don't hesitate to throw back ideas if I have to go back and re-record a class I'm happy to do that and we can do that with all that context we're going to be hopping into unreal we're going to be focusing on visual scripting to help break down those learning curves for you and help you level up so let's hop in unreal get started and keep in mind work in progress don't hesitate to throw in the feedback let's go and first thing we need is we need a project now you could use a blank project you could use if you choose a blank project I found that the blank project is not so blank it comes with this giant world and everything with it and so I'm actually going to choose I've messed with this for a little bit I've also tried the simulation blank I'm just going to go with what I know I'm going to choose the third person project and I'm going to give my project name visual scripting intro and we'll just create that in our normal unreal projects folder now unreal is going to go out and make make this project for for us it's going to restart and then once we get logged in what we are going to do is we are going to set up a blueprint I know you're thinking but you said we weren't going to be learning about blueprints well we do need to set up our classroom and for our classroom I think it's probably best for us to work in a blueprint because that's where a lot of the meat of visual scripting is done so let me make this full screen and you can see we have our third person template and I'm just going to in this content folder all right first hold on you've never logged into unreal before you just created a project you're like holy goodness what am I looking at let's do a quick tour top of our screen this is kind of a review Port there are hopefully you're at least a little bit into games or 3D of some kind if you want to move around in this viewport you can hold the ALT key and left click and drag and that will rotate it point is it's not get lost there we're not even going to really have to do that once we get in the classroom point is this is a viewport over on the right this is our outliner and at the bottom generally speaking is our content browser if you do not see your content browser if you go up to window content browser you'll be able to choose content browser okay with the content browser this is where we store everything that we're working on it's kind of like our our filing cabinets if we have a desk in the top of the desk is our workspace it's sort of like the drawers and the filing cabinets that we're working with underneath so I'm going to create a folder in here by right clicking in gray space and you'll notice at the top fourth one from the top is new folder and I'm just going to call this visual scripting double click on the folder and we should be kind of where we're going to store all of our files initially all right in order to get going to we're still not quite in our classroom but we're getting there now this is the part that's a little bit of a leap of faith so so roll with me if you've never worked with unreal before I think the easiest way for us to focus on visual scripting is to work within a blueprint The quick summary version is a blueprint can do a lot of different things but basically it's an object that usually does something in the world in unreal we are going to specifically we're going to right click here in Gray again and we are going to create you'll notice the seconds the third section down here is called create basic asset we're going to choose blueprint class okay it's going to pop up a window and we're going to pick the first one because I think this is going to be the easiest one for us to work with so we're just going to choose actor and we're going to call this um class one actor and I'm actually going to prefix this we're going to call this blueprint BP underbar class 1 actor okay almost there let's double click on this and this is going to open the blueprint editor let's take a quick break or not a break but let's just take a quick pause and go on a little bit of a tour and take a deep breath so far so good I'm going to save this just so that I have it saved now again for those of you that are completely new to Unreal this is sort of the quick intro we're kind of glossing over this because we're still not quite to the classroom yet we're almost there so welcome to the blueprint editor over on the left hand at the top you know we have all of our menus and things like that we'll explain what this stuff does in a minute on the left hand side you have our components this component section you can sort of think of this as the visual elements of a blueprint what do I mean by that a blueprint can have digital elements for example if you're playing a game and the game has an actor or a a let's say your character the visual aspects of your character the outfit the costume you might see those over here if you're doing a virtual production set you might see over here on the left maybe a camera or something like that there's lots of different visual things that can go into your components below components you'll notice this section called graphs these are these are actually going to be where we're going to be doing a lot of this is where our classroom is mostly going to be in the graphs we'll explain those a little bit we have graphs we have functions variables all of these are part of the coursework that is coming up and then over on the in the middle we have our viewport and this is just the 3D view it works like most other 3D programs in the sense that if you alt and left click you can kind of paint uh orbit around if you middle click you can drag and if you right click well this is all while holding all and you you can basically zoom in and out those are the quick three things we're probably not even gonna have to be super um super Savvy with the 3D for the way I'm planning on teaching this course so just know it's there this is the this is the viewport it shows you all the visual elements usually that are shown in your components section in the top left finally for anything that you have selected over on the right is all the details and these are all the check box and features and things like that sometimes like for example you might have colors over here you might have all kinds of different things and we are going to be using the details panel as well so that's a quick intro to the initial screen when you log in and there are two other tabs you'll notice up here next to viewport one is the construction script we're going to ignore that for now but we're getting closer it's called a script and the other one is the event graph this is going to be where our classroom is we are going to spend most of our time in here teaching you how visual scripting Works within unreal so welcome to class we made it at this point whenever we start class whenever we're working I'm going to try my best to keep it all within this event graph of the actor that we created so if you ever need to get back here if you were to close this all you would do is in your content browser when you first open unreal you can double click on visual scripting you can double click on your blueprint for your class 1 actor and when you do that okay instant freak out what where's all the stuff that you just showed me you'll notice that for some reason this is saying uh it's a data only blueprint we can open the full blueprint editor when we do that we get back to all the stuff that we were used to seeing before all right now we're clicking on the event graph let's clean up the classroom so it's not confusing when we start I'm going to window drag okay so first let's start with what the event graph is the event graph is this is where the meat of the visual scripting some visual scripting happens okay and what it is is if we take a step back and take a look at what visual scripting is and and a lot of this in Unreal Engine particularly is it is actually sort of a visual way to do programming whether you know it or not at the end of the day when you're using visual scripting what is what has happened is the developers of Unreal Engine or any utility that uses visual scripting they have made a whole series of um very programmer slash um logical workflows available to you that you can use in a visual way and are usually a lot more artist friendly but this is where some of the assumptions have come in even though it's visual if you've never written a chunk of code in your life or you've never taken a software engineering class or you haven't been working in unreal for quite some time I think there's potentially a lot of things in here that might be new or foreign so in most visual scripting languages the boxes that you're going to work with are usually called nodes and there are different kinds of nodes and they all do different things so when we first open this event graph we actually have three nodes in here and fortunately with visual scripting scripting in general usually they're named something so that you can look at them and have an idea of what they do in this case we have event tick we're not going to worry about event tick if you're new to gaming and you're new to a real-time rendering all those kinds of things just know that this is an event that ticks what it really is about is it's about when the experience or the game is running the clock is ticking this event is uh kind of in reference to that aspect of it we're going to delete it I don't want you to stress about it we can always get it back later if we need it but we're not going to need it our next event is an event actor begin overlap that might be a little bit foreign to you but if you just read what it says actor begin overlap it probably has something to do with an actor overlapping I don't really know what exactly that means but at least it's it's something I can kind of guess it what it is and then the last one that we have is event begin play now hopefully because it's called begin play you know that this is an event that happens when Beacon play starts hold on a second when does begin play start how do we play all right well in the top you'll see this green button now if you click the green button here it's a play button which is you know very helpful uh if you if you press it here this is actually going to pop open a new window I actually like to go back to my map and press play here if I press play let's just see what happens you'll notice that if I press play we actually begin or start our level we begin playing and whether it's a level or a experience or a virtual production set or whatever we're basically saying Start begin play now and this works just like most wasde third person games so if you uh are a gamer at all and you want to run around a little bit just because it's fun you can use wasd and kind of move your character around when you're done playing in unreal five starting in five I think it was the in order to stop I believe the default is shift Escape you may be able to just press Escape but if Escape doesn't work it's shift escape the other thing you can do is press the red square that's at the top here you can just press stop all right so if we go back let's talk about nodes now generally speaking when I teach introduction to scripting and if you're following along with the intro to scripting for creatives course these nodes that we're creating are a lot like commands or functions or commands or events that we can do within Unreal Engine so this first node that we're working with is called begin play so what happens is when the experience or the game starts if this actor exists in the scene Unreal Engine knows to call begin play when it calls begin play anything we do inside a begin play will then happen now how do we how do we kind of show what that might look like all right what we are going to do is we are going to create a series of events that happen when we get in place starts just to show you how this workflow might go and to do that the developers of unreal have made available to us a whole bunch of fun cool things that we can use to do that so let's create one now in order to create one we basically need to create a a flow a series of events or a series of steps that are going to happen on beginplay to do that we use this white pin here this triangle at the bottom it's called an execution pin so what's going to happen is it's going to come in here and begin play and I'm just left clicking and dragging off of that and when I do that it will show me a huge list of executable actions that it could potentially do now we're not going to get too lost in this you will become more familiar with these as they go but we're going to start off simple and we're going to start off with a good old-fashioned print so I want you to type in here print and you'll notice that under development a print string shows up now if you left click on print string it creates a new node that is a function or a command sometimes it's called an event that literally prints a string that's what it does so what happens is in visual scripting when this event is called begin play starts unreal looks at this execution pen goes to the next node and says what do I want to do oh I'm going to print string what am I going to print well fortunately because it's visual we can see what it's doing uh pretty clearly which is super helpful for people who are new and this is why visual scripting is so accessible to people who are new to programming and scripting in general but it's going to print a string we can tell that by reading it and it's going to print the string hello now if we go back um if we go back before we go back actually every single time you make a change in this event graph you need to tell Unreal Engine to it's called compiling it basically means take what I've done here crunch on it a little bit all down to words and nodes and execution that the engine understands so if we compile this you should get a green check mark if you ever don't get a green check mark you probably have a problem and you have to fix it but we compiled it gets a green check mark and then I like to save it as well just in case unreal crashes or whatever we can keep all of our work all right now we have the in play and print string hello if we go back to our third person map and we press play it doesn't print anything that is because our new blueprint class one actor does not even exist in our experience yet so there's one more piece that we need to do before class is fully ready even though we're well into class at this point what we need to do is we need to drag a copy of our actor into the scene now you'll notice when we do this you can just drag it right in here it drops it in the world you can move it around using these handles up down left and right you'll notice over in the top right in the outliner it creates a class one actor okay and at this point when the experience starts it is going to load up everything that it finds within the world one of the things that it finds within the world is our actor when it finds our actor Unreal Engine says oh I found our actor and then it goes and looks at it and says I have a begin play I'm going to do a thing the thing I'm going to do is I'm going to print string so if we come back to our third person map when we press play now you'll notice in the top left there's a little blue text that showed up it said hello it disappeared really fast so let's stop and let's go back to our print string and let's make some changes to it let's make it a lot longer so we can see it better in this node you can see this little drop down arrow down here these are all of the things that we can do with print string that might be useful to it in this particular case you'll notice one of the things is a duration so let's make the duration of 10. all we do is compile we save this we go back to our third immersion third person map we press play again you'll notice it prints hello and this time hello stays there long enough that we have a chance to read it when I'm ready to move in it disappears after 10 seconds all right when I'm done I can stop playing and come back to our blueprint so we have successfully at this point executed an event and we've executed a node sometimes these are called events sometimes they'll be functions there's there's lots of different names depending on what you dropped out here but for right now I think of this as a print string command all right let's make another one what do you mean another one I mean we can do a whole series of things all right so let's do that so if I print string again I can do that by just dragging off the PIN to the right and I can print string again and what we're going to do in our second in our second node is we're going to print the string world so this is a very classic scripting introduction thing that you do in almost every scripting language and visual scripting is a scripting language so let's just do the good old classic hello world now just like we did with our first print string we are going to change our duration we're going to change it to 10 and we are also going to change our text color let's make it something like hot pink so if I compile this and save this what's going to happen unreal is going to come in here your unreal is going to start the level it's going to look in the level it's going to find our actor then inside of our actor part of what the actor does is it does the begin play and then it starts executing our visual script the first thing our visual script does is it prints a string the second thing our visual script does is it prints a string let's take a look at that in after you'll notice in the top left we have hello and a nice turquoisish color and we have World in hot pink this is awesome so we're starting to understand how nodes and commands work and we're starting to understand the execution flow of what's happened quick little break I forgot to mention something you'll hear me mention it later in this video it's pretty important as our node graphs start growing to know how to actually navigate this window it turns out that in order to navigate this window a couple quick commands that you need to know or not even commands if you right click in Gray you'll see that the cursor changes to a hand if you right click you can actually Pan the window if you alt while right clicking you can zoom in and out and that's going to be important as you start adding more nodes on to this execution chain and you'll hear me mention it later because I completely spaced and forgot about it so there we go let's get back to our regular scheduled program now at this point I'm going to kind of just roll with that you're kind of understanding this loop we're basically going to make changes to our script to do different things and as we make those changes and we we are we're going to use this Loop where we compile save and begin play to start to introduce the idea and the fundamentals of visual scripting in this case right now we're talking about commands soon we're going to be talking about variables and then we're going to talk about control flow and then we're going to be talking about a lot of different things but this is the loop that we're going to be doing it and we're hyper focusing in on just the visual scripting aspect of it we're going to learn some blueprint stuff along the way just by accident and that's cool but for now let's hop back in okay now what else can we do with uh you know our visual scripting what if we how about how about we just kind of take a take a cruise and see what else is available to us let's see um let's try draw let's type draw now there is a draw there's a couple different draws in here there's drawing debug boxes drawing debug let's draw a debug sphere all right now this one is a little bit different and what I want what I want you to start to understand is these commands these functions that we're creating um and they each of them does something different and these are in order so we have our our first print our second print then our then our draw debug sphere now what is a debug sphere basically all it does is it draws a sphere the interesting thing is the difference in the information that you give each of these so you'll notice our print strings they take a string we can choose whether it prints the string or whether it prints the log we can choose a color duration Etc the sphere is a little bit different and we're going to get into how all these things get created and whatnot later but for now these are all the cool commands that are available for us to use that somebody else has written and we are going to be using a ton of them so for our Sphere for right now let's just keep the center at zero zero zero that is a location in space we'll keep our radius at 100 segments is fine line color notice this our duration is zero and our thickness is zero so even though I have this debug sphere if I compile save this and I run our game I don't actually see the sphere anywhere in here I'm I'm assuming zero zero zero is somewhere in this scene but I don't see it and I'm moving this camera but just by left I just tapped and I'm just moving my mouse okay and the reason we don't see it is because we didn't set a duration if we set the duration to be 10 seconds and a thickness right now zero thickness means it doesn't have any thickness if we set our thickness to one we compile and we save this then we go back and we press play you'll notice that well I don't actually see our sphere I wonder where it is let's go back and take a look Center of zero zero zero thickness of one duration where is zero zero on our map let's make the let's let's make the radius bigger see if we can find this sphere compile and Save and play I do not see it ah here it is it's behind us I didn't notice it was buying it so it looks like our map the zero point on our map is behind us so let's change this a little bit so right now we're going to just type in a value just to make it easier if we look at where our actor is in the scene you can see it's dragged out here if you look over here in the outliner on the right under details you'll notice that there is a location here and the location is 15 30 10 10 and 20. if I right click on this I'm going to choose copy we're going to see if we can paste this in here taste you know it didn't like that so we're gonna do it one at a time so let's take 15 30. and then it looks like 10 10. and then 20. so I'm just changing where the center of the sphere is now I'm going to change my radius back down to 100 and we're going to compile we're going to save this and we're going to press play there it is there's our sphere okay so at this point you have successfully kind of got the classroom set up and now now we're starting to do it we're starting to work with visual scripting and what we're looking at right now is the flow we're looking at the execution order in our execution order and understanding that is basically starting with our begin play and then we're using these node links to determine what happens next so if we wanted to we could also draw a debug what do you all want to draw how about we do a um no cylinder now cylinder you'll notice is even different it has a start and an n and a radius so let's see if we can oops put it in the same place as our sphere and we're going to put we're going to make it 200 units tall because it starts it basically this is kind of I think this is the base and the end we have a radius we have we're going to make it blue let's make it blue so that we can note that it's a different color we'll change our duration 10 we'll change our thickness to one and we'll compile that and we'll save that all right you'll notice that we have now a sphere and a cylinder so in unreal there are a lot of different commands that are available to us that we can use now one of the other things that we can do is we can actually use these commands to change things in our scene so for example let's see if we can create something other than these debug spheres so I'm going to drag out here and see if we can create uh let's see what's interesting and easy for us to use that is not too complicated oh we may maybe not create let's try spawn let's spawn let's spawn a system at location all right now what is this if you've never used unreal before a system is a particle system and I I've just chosen this one because it is a straightforward command doesn't require a whole lot of extra craziness and we'll be able to work with this to do different things and change our flow so the system and the location is it works just like everything else before we specify the location and so on but what we need to do is we need to pick a system we have no systems okay that might not be a good one spawn let's try spawn emitter at location do we have any emitters yes we do okay great so we're changing this to emitter like I said we're making this glass up on the Fly it's gonna be awesome it's gonna be fun all right so we're spawning in a minute and we're doing this intentionally just to keep things focused the emitter I'm going to choose to spawn is the tutorial particle system and we just need to connect our execution pin and let's set our location to be the same location as these other debug objects for example we'll keep our rotation Auto destroy and all that stuff let's just compile and save this and let's see what happens when we run there we go we have our emitter that's pretty cool okay but what can we do with this wouldn't it be cool if uh we made the emitter move let's give that a try so if we come back to our blueprint so we're spawning you notice that our text our hello our world those both disappeared then our debug sphere Drew and distorted our cylinder so now we spawn in emitter now in order to make this emitter move what we can do is we can set the location this is where we're going to make a slight change so far we've only been dealing with these white pins these are the execution pins these determine the Order of Things well one of the things that we can do is with our emitter we can basically use the information of the spawn to make changes so what I'm going to do is from this return value I'm going to drag out and I'm going to set location and what I'm going to do is I'm going to add a world offset you'll notice it connects both pin so what happens is I spawn my emitter and then I'm going to add a world offset of 100. now let's go let's go 200 so that should be 2 meter now if we compile and we save this and we play it's going to be really hard to see what's happening and I'll show you why if you'll notice our emitter is already 200 units away we didn't actually get to see it move because what happened was when unreal started if we escape out of here when unreal started it came into our blueprint started begin play printed hello world drew the sphere drew the cylinder spawn the emitter and move the emitter right away almost instantaneously it happened so fast we didn't even see the emitter move wouldn't it be cool if we could actually watch it move we can so I'm going to make two changes to this I'm going to move this over and I happen to know that there is a node that is called delay let's type in delay now the delay is basically exactly what you would expect it delays for a certain amount of time now in order to give ourselves a little bit of time to recognize what's going on I'm just going to change my duration of the delay to be two seconds all right now we have a two second delay I'm also going to change our location to be 200 and Y instead because it's going to be easier for us to see so if we compile and we save this when we start same thing's going to happen it's going to go through all of our execution by following our our pins or those white lines and then it's going to hit the delay and it's going to count to two and then it's going to move so we'll be able to see our particle system move this time here we go all right so it starts out where it is and notice it just kind of moved over to the side we did that that was us that was visual scripting this is getting this is going to this is going to be a lot of fun we're going to be able to do a lot of really cool stuff so now our our particle just sits here in the world if we wanted to we could put in another delay we can copy this okay so let's talk about let's talk about this um part of me is like we should just do it the old-fashioned way drag off this type out DeLay So you get used to used to using this and clicking on delay Etc but also we want to learn some shortcuts along the way visual scripting on real engine is really cool you can copy and paste node so if I pick this delay node and I press Ctrl C I can come over here and press Ctrl V and it will paste it it knows how to copy and paste its own node so I can drag this pin over to here connect them up and then I can copy the add World offset node and paste this as well now when we do this this is not going to work if we compile it you'll notice I get an error all right so now we're starting to get into a little bit the information that unreal helps us when we're visual scripting as far as letting us know when we did something wrong in this case for some reason we have an error we know we have an error because when we compile there's a red circle up here and unreal is nice enough to highlight the node and put the word error on it that is causing the problem so if I Mouse over this word error it says the blueprint cell is not a scene component therefore Target must have a connection okay if you don't understand the first part because it's kind of it's kind of out there the whole blueprint itself and not having a scene component there let's just take the end Target must have a connection okay well if we look at it our target has a connection here oh so I need to connect the emitter to the move just like I connected the emitter to this world offset move I need to connect it to this one how do I do that what you can do is you can drag off of this pin and you can connect to more than one item so I can connect to this world offset and I can also connect to this world offset now when I compile now add World offset which is expecting a Target to move as a connection so it knows how to move it so now it's going to happen and we're going to come back and clean this up in a second what's going to happen is we're going to spawn we're going to move a minute or two more seconds later it's going to move again so let's just watch this happen foreign there's two seconds two seconds so we're just moving our mirror across the map right now kind of cool okay let's go back what is it that I meant by cleanup well as you learn visual scripting it's important that you work in a clean manner what do I mean by clean if you come in here and you look at what we've done so far it's very easy to say oh one two three four you can you can easily see what's happening if you came in here and this stuff was all over the place kind of mixed up garbly Etc it's very difficult to follow what's going on here I can still do it I have to follow the lines in this kind of twisty tour it's a lot better it's a lot easier for you to follow and for the next person who's also potentially working with that to follow to uh do so in a mostly clean fashion okay so I'm going to I'm going to cheat a little bit here and I'm gonna use a hot key to get this back if I pick all of these nodes and I press the q key they line up for me if I undo that if I pick all these nodes I might be able to right click and choose alignment and choose a line I think it's straight in connections you can see this right here so you can either press Q or you can straighten and then I can even right click if I want to get super diligent about this and I can distribute horizontally and I'll make them all evenly spaced so same thing I'm going to take all of this I'm going to so I'm just going to highlight all this and press q and it's going to line them all up now here's the thing when we look at this oops when we look at this it's very difficult to see what's happening in here what's connected to what so it would be great if we could clean this up to clean this up what we're going to do is we're actually going to redo our connections a little bit and I'm just moving these out of the way so I can temporarily see what's happening our emitter and location is being connected to our ad world offsets let's disconnect them all right whoa disconnected we haven't even talked about disconnect we know how to connect things we just drag to them how do we disconnect if we right click you can choose break this link and that's going to disconnect it right click break this link now this time what I'm going to do is I'm going to drag from the blue circle to the Target so that the adding the world offset we know we're adding the world offset to our spawn emitter then what I'm going to do is I'm going to double click on the blue line when I do that it creates what's called a reroute node and what this does is this allows me to kind of shape the the the way these lines work and I can reroute blue lines I can reroute all the lines effectively and so now what I can do is you'll notice that it's a lot easier for me to make this visually more readable what I'm going to do from this reroute node because it's all still connected what I can do is I can drag off of this and it's almost it's the exact same thing as dragging off of the original return value I'm going to drag off of the reroute node and I'm going to connect it to my next Target I'm going to move my delay down but this you know still not super visually appealing to me so I'm going to double click my reroute node again and I'm going to put that in here now the reason I've done this is because I can very clearly see if I'm ever looking at the world offset node over here I can say oh what is my Target and I can follow this back and say oh it's the spawn emitter at the location and I can follow these reroute nodes so I will often make it so that these connections are done similar to this fashion and you'll see me doing this as I work because if you ever come back to it trying to understand the mess if all of these are up here what happens is you can kind of see you don't know if these blue lines are coming off of this connection point or that connection point or where it's coming from so it's just easier to keep them clean for me and I'm always going to work like this as much as possible sometimes when I'm when I'm sometimes when I'm setting up a script I might get a little bit messy as I'm as I'm working towards getting to the the end goal but I always go back we have a we have a rule at work always leave a blueprint cleaner than when you found it so anyways uh you'll see me doing this just normally as part of building good habits alright now what we've done is we've basically just cleaned up our blueprint we're still doing the same thing we're still printing hello we're still spawning spheres and cubes and all those kind of things and we're also shifting and moving our um we're also shifting and moving our particle system in the world this is all using built-in unreal commands nodes functions things that the developers have created for us to work with as we go forward we are going to be building our own we're going to be using control flow to make decisions within our visual scripts we're going to be using variables to make them more powerful and we're going to be using functions to make them more reusable we have a lot to do throughout this course hopefully to help you all wreck the learning curve when it comes to Unreal Engine and visual scripting now one more note that I'd like to cover beforehand is we already talked about these reroute nodes on the blue lines you can do the same thing on the white lines we'll just throw one in for ease if you double click you'll see this reroute node shows up and I can just drag this around now if I undo you can also right click and type reroute and there's an add reroute node I just find it's easier to double click and and add it in there so compile and Save let's go back and take a look at our map one last time and we are going to watch our particle system move cool okay now let's take a look uh we're going to we're going to work on one more bit today I think so that you all have a good understanding of how we can access different aspects of a blueprint as well right now we are in our begin play we are basically doing all of our prints or draws and moving our particle systems most of the time in blueprints you will have some kind of visual piece in your scene components so we're going to add one to our actor so that we can use it to do things so let's do that in the top left of our blueprint you'll notice a section that says components and in there we're going to add a component and we're going to choose static mesh when we do that let's just go to the viewport real quick so you can see this happening on our static mesh you'll notice over to the right there is all kinds of information over here the thing that we need to fill in is we need to tell this static mesh what kind of static mesh to draw there is a section it's depending on your unreal version It's usually about the fourth or fifth one down it's usually denoted by these um nice kind of cyan color I think it's cyan it's a blue and if we just click the drop down next to that we get to choose any of the static meshes that are available to us so let's just find something cool yeah now you can keep it simple you can pick a sphere for example and maybe that would be the way to go I'm just going to see what might be cool here you know what I am going to keep it simple let's just in our search assets just type in Cube and the cube that I want to use is let's use the third one down it's just called Cube static mesh and when we do that you'll notice that um it's very large we were zoomed in too much uh you might have to zoom out if you press f it will frame it if you um alt hold the ALT key and right click and drag you'll notice that uh you can zoom in and out but usually f is enough now the other thing that you can do if you want I mean this is just a general default gray material that's fine what I want you to notice is if we compile this and we go back and we look at our third person map you'll notice that our Cube is sitting in our map because it's part of our actor okay so let's go back to our last one actor let's go back to our event graph now let's do some stuff with our Cube how do we do that well uh the same way that we have basically set up nodes and and and things like that we can move our Cube we can scale our Cube we can set different visual aspects of it in order to do that what we need to do is we need to get uh the ability to access the queue a handle to it it might be called or a reference to it the cool thing is it's visual so it's just easier for me to show you now in this case you'll see here the static mesh is up here on the left if I just drag this out into our event graph what's going to happen is you'll notice it gives me a node or um it's basically a reference to our static mesh so now I can use this to manipulate our Cube and what we're going to do is we're going to drag off of the Blue Dot from static mesh and I'm just going to try set location yes so we're going to do the same thing we're going to add a let's add a world offset just like we did with our particle system and we're going to do that and you'll notice it creates the box it automatically connects our static mesh to the Target we just need to connect our exit execution pins and the location that we want to offset because it's a world offset let's go the other direction our particle system is going right let's take our Cube to the left let's go minus 200. okay when we compile this save it and we press play what's going to happen is we're going to play all of our cubes and everything are there particle system moves and then our Cube moved after the particle system why did that happen hopefully you can just follow this by following your blueprint Again Play started we printed hello then we printed world then we drew a debug sphere then we drew a cylinder that was almost instantaneous it was instantaneous then we spawn in emitter so when we first started you saw the emitter sitting right there then we did a delay we waited for two seconds then we added a world offset to the emitter then we delayed again then we added another world offset to the emitter and then we immediately removed the cube so if we do this again what you will see or you should see is on the second move the cube and the emitter will move at the same time so let's just double check that so we that our understanding of the execution flow is solid watch the cube in the emitter on the second one same time cool now we can actually do the same thing here and split this up and we can add in a delay here I'm just going to drag off of this pen to show you one other feature of unreal scripting or um yeah unreal visual scripting if we type delay in here and we click on it it's going to automatically connect it for us and if I type in here let's do a one second delay now what's going to happen is after our second emitter move we're going to delay a second and then we're going to move our static mesh so let's go back and let's compile this save it and let's play same thing let's watch it all happen the other Q moves our emitter moves it moves again one second later the cube moves and I actually meant to say our Cube our cylinders and everything got spawned okay let's make another change in here I'm just going to move this up because I it's driving me nuts to see it going through the floor we'll move it up I'm also going to scale this down a little bit skillets in half so it's not so massive I do that by selecting the cube static mesh and then I can just change the attributes over here 0.5.5 for scale and I can move it down um probably 25 or move it by 25 that I think that will be sitting on the ground we'll see on pile save and then we run you can see our cube is much smaller now it's not taking over the whole scene one second later the cube moves now we can do this all day long anything that we put in our components we can get reference to like we've done here for the static mesh so if I come back here let's add a sphere all right now if we go to our viewport this sphere is inside the cube so what I'm going to do is I'm going to click on the sphere and I'm going to move it outside the cube just so we can see it and I'm also going to add a what else can we add to this that might be interesting oh how about a cone okay let's we added the cone now interesting thing happened when I added the cone it actually parented it to the sphere I don't want to get too lost in this but there is a hierarchy to the components so right now if I move this sphere the cone moves with it I don't really want that so I'm just going to click the cone and I'm going to move it underneath the default I chose attach there so now they're all at the same level so I can move my cone separate from my sphere separate from my Cube okay when we go back to our event graph we can compile this and save it when we go back to our event graph we can do the exact same thing with our cone and our sphere that we've been doing with our Cube and by simply dragging out dropping it in and saying I want to work with this sphere now what do I want to do with this sphere let's see if we can scale it up set nope oh I spelled that wrong okay so we have scale can we set the scale we can we can't we can set the relative scale in 3D or we can set the world scale so let's just set the relative scale and I'm going to make relative scale of oh this is going to be interesting we need to see what this is going to do if we set a relative scale of one one one let's see if our sphere changes size compound save before we move on okay it didn't change size so what it actually it's not an it's not an add-on it is actually a it is actually setting it so now we can do what I originally wanted to do which was to make the scale grow I mean make the sphere grow foreign grow double the size I'm going to reduce these delays because I think you get the general idea we can go a little bit faster so I just picked each delay I set them down to one by the way uh it's probably a little late for this how am I moving the graph around I'm right clicking right clicking and dragging to move the graph around that would probably have been a good thing to go over again so many things that we take for granted if we have worked in these kinds of environment stuff before which is why we're trying to kind of go over and break some of this down so this is where your questions are going to make this class better that mistake alone might be worth going back and re-recording and I'm going to defer that to all of you based on your comment so I'll probably throw that in the description so that you know how I'm shifting this graph around but basically if I right click to drag it and I alt click and right click at the same if I hold alt and right click at the same time I can zoom in and out if I highlight four options uh can I frame on that view Zoom to selection is the home right I didn't even know about the hotkey that's kind of cool um view Zoom the graph extents so I can basically pick three of these and press the home key and it'll Zoom all in oh that's pretty cool learn something new every day okay uh so I will I will add that uh right click to drag alt plus right click to zoom to the description in the YouTube video um and we'll go from there now let's see here so we have our scale now we're setting our scale 3D let's compile and save that and let's run this all right so one second later particle moves one second later again and then you notice that our our sphere is now changing in size all right so this is it this is how we execute commands that have been created for us by the developers and eventually one day ourselves this is how we can interact with objects we can do the same thing with our cone and start to move things around let's just do the same thing with their cone we'll set the scale I'm going to copy paste don't forget to connect the cone to the Target and this the cone is now also going to get setup so Oracle moves boom both of those pop and grow in size very cool all right so let's wrap up a little bit of where we got to today yes we had a little bit of setup we had to get our classroom up and running but we got into visual scripting today was all about familiarizing ourselves with the blueprint we're going to be working in to focus on visual scripting and the visual scripting aspects that we talked about today were all about familiarizing ourselves with nodes functions how do we connect them the execution order uh you know little things about working cleanly getting references to our components connecting those in all those kinds of things so this is really just kind of starting to get us used to how do we create how do we even create and start to create a visual script this is very much a we're making this up as we go if you have comments things that we could approach differently something that wasn't clear throw those in the comments maybe we need to record another class happy to do that I've even told you with the idea of doing this live so as we move forward all feedback is welcome and do keep in mind that we are focused here not mainly on blueprints we are focused here on visual scripting for all of you who maybe have never had a traditional programming class or scripting class and are missing some of just some the foundational pieces of understanding of what you know variable variables are in for loops and control flow and uh you know inheritance and all these kinds of things that's all the stuff that we're going to be talking about as we move forward as always your help is appreciated if you like this video like these contents you think what we're doing is a good idea just help share it out help support the channel in any way you know best you're all social media gurus at this point so support the channel any way you know how and I will be getting the next class together I hope you all have a good one and catch you on the next one [Music]
Info
Channel: Ask A Dev
Views: 7,572
Rating: undefined out of 5
Keywords:
Id: IipvT6aGinM
Channel Id: undefined
Length: 59min 45sec (3585 seconds)
Published: Sat Apr 01 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.