Unreal Engine 5 | Blueprint For Advanced Users

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
Hello guys, welcome back to another video. In this video we will be covering everything you need to know about blueprints as an advanced user. This is the third and final video in my blueprint series. So if you are new to blueprints or haven't watched the previous videos, I recommend you view them before watching this video. I have a blueprint for beginners tutorial and a blueprint for intermediate users. Now in this video, the blueprints for advanced users, we will be covering over blueprint interfaces, and How you can use them and how to implement them in many different ways. I will explain in great detail and show you why things like casting can be bad for performance and why blueprint interfaces is much more efficient in terms of performance. And I will show you many different ways of creating and implementing blueprint interfaces. Whether that be to communicate between two different Blueprint classes, to send things like variables, call events, call functions, or to set other variables. After we cover over Blueprint interfaces, we will dive into other topics such as the Event Tick. What is event tick and how you can avoid using it. We will also look into other different types of events or components that tick inside of the engine. Concluding that we will cover over things like blueprint functions, the two different types of functions, pure and impure functions, overriding functions, function inheritance, And even creating things like our own blueprint function library. Next, we will cover over what are macros, how to create them, and the differences between a macro and a function. And then after that, we will go over a few different methods of debugging your blueprint. Things like using the common print string node, using breakpoints, and watching blueprint values. Lastly, we will cover over the Unreal Engine class framework and all the classes that are related to the game mode class. Things like our character or pawn, the player controller, the game state, the player state, and whether or not you'll actually need to use these classes depending on your project type. If you guys enjoyed this video and this free blueprint series, make sure you consider subscribing. I put a lot of effort into these free tutorials. Also leave a like and a comment down below. So just let me know you guys overall thoughts on the video series. And if you reach to the end of this video and you end up enjoying this free tutorial, you can check out some of my premium courses on smartpoly. teachable. com. If you are interested in making games inside of Unreal Engine, luckily for you, I have a complete multiplayer survival game course, where we create a complete survival game. Multiplayer survival game from scratch. I will be adding more courses in the future. So the chances are, if you're watching this video in the future, you can check out my website, smart poly dot teachable. com to check and see if there's any new courses. Now, without further ado, let's get right into the video. All right. So let's go ahead and create the project. So first of all, let's launch on religion 5. 3 or in your case, if you're following this video in the future, uh, you can launch on religion 5. 4. It should be the exact same. I want to select the games template and under the games template, when I choose the third person template, and then we're going to include a starter content. So we can include a couple of different assets that we can use, and then we can just rename this to. Okay, so now that we are in our project, the first thing that I want to go over and discuss with you are blueprint interfaces and casting. So I want to explain very clearly why you should use blueprint interfaces. Overcasting and I'll show you how to implement interfaces with many different examples. So if you don't watch the rest of the video, uh, at least watch this part because I think this is the most important part or the most important principle that you should learn about blueprints and communicating between other blueprints. So the first thing that we're going to create is we're going to create a door blueprint that we can open and close. And we're going to create the traditional method using casting. So let's go ahead and in our content browser, we're going to right click and create a new folder for blueprints. So double click and open that up. And we're going to create another folder here and call this door. And then in this door folder, we're going to right click and create a new blueprint class. We'll be type actor and we'll name this to BP underscore door Casting. Okay. So this will be our door that uses casting. So double click and open this up Let's dock this at the top. And so in here we're going to set up a basic door blueprint basically, we want to set it up the same exact way that we Created our door blueprint in our blueprint for beginners tutorial. So I'm going to add static mesh. This will be our door mesh. I'm going to add another static mesh and let's actually parent this to the default scene route. So if we drag and drop it on the default scene route, we can click attach. You can see they're both side by side and this one will be our door frame and then just select the door frame mesh. And under the static mesh, we can hit the drop down and search for door frame. Okay. We can use that static mesh door frame. This is in the starter content. So if you don't have the starter content, you want to make sure that you add it to your project. And so we have the door frame here, and then we have the door mesh. So under the static mesh, we hit the dropdown and search for door. We should have SM door. Okay. And then we just got to line up the door or the door with the door frame. Okay. And we can turn down the snap size to get a precise placement. Okay. So I think that is good. Okay. So we can compile, save that. And then lastly, we want to select the default scene route, add a box for our box collision, and this will be our overlap box. So let's go ahead and scale this like, so scale this up, up like that are and scale this like, so, so this will be sort of like the interaction volume. To open and close the door. Now in the event graph, we're going to go ahead and set up the events so we can delete all of these right now, select and delete those, but we have this box collision box. If we select it and in the details, scroll down, we have the event, begin overlap, then select that box again. And we add the event on an overlap. So those were go ahead and add those events. Then we want to just set it up the way that we had it set up in our beginner tutorial. So off of this other actor, we're going to do a cast. So we're going to do a cast to third person character. Okay, so again, what the cast does is it checks and sees, is this actor that is overlapping this box, is it this third person character? And then if so, we want to enable or disable input. So we want to right click, get controller, get player controller. And we can do a enable input, like so, and then down here again we want to do a cast to third person character off the other actor, and then off of this player controller we want to do disable input. So basically, if we overlap with the box, we'll enable input. If we leave the overlap box, then we'll disable input. Now, for the actual opening and closing of the door, we're going to add a key. So we'll add the E key. We're just typing E, and we should have the keyboard event here somewhere. So under the keyboard events, we can scroll down and look for E. And then we want to do a flip flop. So this will either close the door or open it depending on current state. Then next step, we want to implement a timeline. So right click and search for timeline. Well, this will handle the rotating and closing of the door. So name this to open door time line and double click to open up the timeline. We're going to add a track. Probably type float track. And we're going to add two different points. Because it gives us this curve. Or this graph. So if you right click anywhere on the graph we can add a float key. Add key to curve float. And if you have that selected you can see we have two different values. X and Y value. So we have time on the X. So we can set that to zero. And the value can be also zero on the Y. Okay. Then click anywhere else on the graph and add another key. And if we select that value, you can set the time to two seconds on the X, and the value can be 90 degrees on the Y. So we hit these two buttons that will zoom fit horizontal, zoom fit vertical. So we can now see both points. Now all we have to do is left click and drag to select both of these. Right click and add a auto interpolation. So that will add a nice smooth curve between the two values. And then lastly, we want to adjust the length here to two seconds, so that it will start at zero and end at two seconds. Off the graph, if we go back to our vent graph, you can see that we now have that output. So we're going to use that to rotate our door. And set the door rotation. So off of this updates, we're actually going to get our door mesh and we can do a set relative rotation. So set relative rotation. We'll set the rotation of our door of our door mesh. Then for the update, we want to hook that up for our new rotation. We only want to modify the Z value because if we go into the viewport and if we select the door, if I press E and see that we can rotate it on the Z, you know that this is the Z axis because we can. See that it's color coded by blue. It shows us it's the Z down below there. So we only want to modify this door rotation on the Z axis. Off this event graph, we want to do a make rotator. So at the very bottom, make rotator. What that will do is it will split up that rotation into three different values. And here we can actually just modify the Z value. Okay. So for this new track, we can just plug it into the Z. So only rotate it on the Z axis. Now, for our flip flop, we want to play this from start, plug the A into play from start, and then the B will reverse from N. So basically, if the door is already open, We'll reverse from end. If it is closed, it will play from the start. So compile save. So that should be our basic interaction logic for our door casting. Basically, if we overlap with the box, we're going to cast the character, enable input. If we leave this interaction box right here, we want to disable input. If the character is inside the interaction box and can press E, I will go ahead and play the timeline and set the rotation of our door to open or close. Let's go back to our third person map and let's drag in our BP door. And now i'm going to go ahead and hit play. So if we go up to the door, We're overlapping with the box and press e. Okay. Looks like we have a little bug there So I forgot in our BP door casting to hook up this enable input We want to hook the player controller reference the git player controller Into the player controller. So you can use alt drag, or you can unhook that and re hook it up to player controller. Okay. So we want to enable and disable input for the player controller, compile, save that. And now if we hit play, we can run up to the door, press E. I'll go ahead and open and press E. I'll go ahead and close. Okay. I leave the interaction volume. If I press E, it won't open the door. If I go back in there, I can press E. I will open it up. And if I go back here and press E again, it will close it. So very simple door blueprint. All we're doing is we're doing a couple of checks, doing a little bit of casting and we're enabling input. Now, there's a few issues with this, the way that we have things set up. For one, we are using casting, and casting is one way of doing things. And in fact, casting is also a way that you can retrieve variables and information from one class to another. So you can sort of use it to communicate between two different blueprints. Now, the problem with using casting is that it creates a reference. To this character and basically what it does is it will load that character into memory So we're going to create a whole nother blueprint that is going to be utilizing interfaces And I'm going to show you guys the difference between those two different blueprints and why casting can be inefficient so in our content drawer, we're going to We're actually going to duplicate this blueprint. So right click and duplicate this. And this will just be our bp underscore door interface. So this will be our blueprint door that utilizes interfaces. Let's go ahead and close the other one, our door casting. We don't need that. We're going to open up our bp door interface. And in here, we basically want to delete This event begin overlap and the enable input all of that. And then we also want to delete this overlap box. So we can delete that. And for this, we're going to add a blueprint interface and a interaction system to this door. So basically when the character presses E on their keyboard, it's going to check and see if there is a object in front of the character. We're going to do sort of like a trace. And if so, then we're going to call her interact. Interface on that object. And if it implements that interface, we can call the function to open or close the door. So we're going to add a new blueprint interface. So in our blueprints folder, let's right click and create a new folder and call this interfaces. So double click and open that up and to create a new blueprint interface, you just want to right click. And under the blueprint, you can click this little drop down and you can see that we have this blueprint interface. So go ahead and select that. And for this, we name this BPI underscore. And the reason why you name it BPI is for blueprint interface. And then we'll name this interact. So this will be our blueprint interface interact. So double click and open that up. So this is the blueprint interface window. So you can see, we have sort of this graph that you can pan around. Zoom in and out. You can see over here on the right, we have this my blueprint tab and we only have these functions. So we have currently this new function. We can add additional functions by clicking the plus icon. And then down here in the details, we have things like inputs and outputs. So the first thing that you should note is that blueprint interfaces allow you to create either functions or events. So in our case, the first thing that we're going to create is a event. So we want to right click to rename this. So if you double click or if you right click and click rename, we could rename this to interact event. Now it looks like a function, but we're going to actually add this as an event. So we want to hit compile and save. And then now let's go to our BP door interface. And now to add that interface event to our door actor, want to head over to the class settings. So we click on class settings right over here, over in the details panel. Down at the very bottom, we have this implemented interfaces. So this is where we can add that interface that we created. If you click this add, it will show a drop down of all the different interfaces inside of the engine. Now we're only interested in the one that we just created. So we can type in BPI underscore and you can see that's the first one that pops up. It's very useful using that naming convention, uh, the BPI. And so we can select our BPI interact. And now if we hit this little drop down, You should see we have that BPI interact under our implemented interfaces. Another thing that you're going to notice is down here on the left, under the My Blueprint tab, under the interfaces, you can see that we now have that interact event. And also it wants us to compile our blueprint. So let's go ahead and compile and save our blueprint. But now we have this interfaces, this interact event. And so to implement this interact event on our event graph, all we have to do is double click, And what that will do is it will add This event interact event. So it says event interact event from BPI interact. So this is our blueprint interact event that we created inside of our interface. Okay. So you can see that this is event because it's red has this red color. And you can see that it has this interface icon. And then now what we want to do is instead of using this E key right over here, we can delete that and just hook up our interact event to this flip flop. So now we've just implemented our first blueprint interface to our door, and this will serve as our simple interaction system. Now, all we have to do is open up our character blueprint and call this interact event. If we overlap. with things like this door. So we're going to go to our content browser and go to our third person blueprints, and we should have our third person blueprint character class. So double click and open that up. And in here we have a very simple character blueprint. So anywhere in the event graph, we're going to go ahead and add the logic to interact. Now we're using the enhanced input system. You can see, we have these input actions. So we're going to actually create a new input action for interacting. So to create a new input, we want to go to our content browser and under the third person input, we have this folder for actions. And so we have things like jump, look and move. And these are the same inputs that we have here on the character graph. So we're just going to create another input like that. So in our content folder, we can right click and create a new under the inputs want to create a input action. So select that. And we're going to name this to IA for input action, underscore interact, and then just double click, open that up. And for this. Under the triggers, want to add a new trigger and under this index, you want to click this dropdown and choose the pressed option. Okay. So basically if we press the interact key, it'll go ahead and trigger this interact input event. We can close out of there. And lastly, we need to back out of this folder and open up our IMC default or our input mapping context default. So double click, open that up. And in here we have this array. So if you hit the dropdown, we have this array of inputs, input action, jump, Move and look, if you hit the dropdown, you can see the different keys that this input is bound to. So basically this is for handling things like binding keys to our inputs. So in our case, you want to add a new mapping. And for this input action, we want to hit the dropdown and select our I a interact or input action interact and hit the little drop down there and we want to choose a key for interaction. So if we click this drop down, we can search for the, for the E key type in E. If you scroll down, we should have the E key for our keyboard. So hit save. So now that we have that interact input action. Bound to our E key. So we can close out of here. And if we go into our third person character, we can right click and search for our input action, interact. So, and so we want to add this under the enhanced action events. Want to add this event, I, a interact. So it'll look exactly the same way. It'll be the exact same way that we implement our movement inputs. Uh, using the enhanced input system, like what is set up in the character blueprint. Okay. So we have our interact input. So if the character presses E on the keyboard, it will call this event. What we want to do here is we basically want to do sort of a trace in front of the character to check and see if we are near a actor that is interactable. So instead of using what we did for this other door, where we had this box collision, what we're going to do is only when the player presses the interact key, We're going to do a trace in front of the character to check and see if there's an interactable object in front of it. And hopefully this will all make sense here in a bit. So off of this triggered, we're going to use the node called multi sphere, multi sphere trace by channel. And so what this node does is it allows us to do sort of a sphere trace in front of our character. It gives us two locations, a start and end point. So for this, let's go ahead and right click and search for get actor location. So we're going to get our actors location in the world. And we can just plug that in for the start and end for the radius. This will be how big our sphere trace is. We can type in a hundred and we can go ahead and just leave all of these as the defaults. Want to ignore ourself. We don't want to hit ourself. And then what we can do to visualize this is that we can do a draw debug sphere. We have debug, draw, debug sphere. And for the center, we can hook up our actor location for the radius. We can have the same radius as what we set here, a hundred. And for the duration, we can set this to maybe one second. So compile save, we can go ahead and now test this out. So if we hit play, I press E. You can see that it creates this sort of sphere trace around our character. And right now it's not checking anything, but it's just doing a trace. So if I press E, it's going to check and see if there's any interactable objects near the player. So that is our simple trace. Now what we want to do is, off of our return value, we want to do a branch. So drag that off and do a branch. So that will go ahead and check and see if we actually hit anything. Because if we didn't hit anything, we don't want to do anything. But if we did hit something, we want to check and see if it's interactable. So off of our out hits, this actually gives us an array of different things that we hit. So if you overlapped multiple different objects, it would be in this list of array. Now, in our case, we're just going to keep things simple. We're going to just get the first thing that we hit so we can do a get, get a copy, and that will just get the very first thing that we hit. In this array, okay. It'll get the first index. So off of this output, if we drag off here, we're going to do a break and that will break the hit result. So off the break hit result. If we expand this, it gives us a lot of different outputs here. Things like the location of where we hit it. hit actor, the thing that we hit and a lot of other things. So in our case, what we want to check and see is if the hit actor, the actor that we hit, we want to check and see if it's interactable. And if it is interactable, we want to call our interact event. So one way that we could do that is of our hit actor, we can call our interact event. So now if we type in interactive event, you can see we have this interact event message. Okay. So this is our, under our BPI interact. Interact event message, our interface. So if we select that, you can see that it gives us this little blue node. And it has sort of this mail icon. So we know that this is a interface message because it has this little letter icon. So now we can hook this up for the true. And so if we do a trace, if we hit something, we're going to check and see if that hit actor implements this interface, interact event. And if it does, It will call this interact event on that actor. And in our case, it will call on our door interface, this interact event, which will open or close the door. So let's compile and save this. And now what we should do is let's delete this door and let's go to our blueprints door and let's make sure we drag in the correct. Door. We have our BP door interface. Okay. You'll notice that this one does not have the collision boxes. So it's purely using our interact interface. Let's go ahead and hit play now. And you can see we press E that does our little trace. So let's walk up to the door and press E and you can see that it overlapped with the door and it called that interact event. Which called our timeline to rotate the door open. So if I press E again, you can see that we can close the door. So all this is doing is it's checking and seeing if the actor that our trace overlap implements this interface, interact event. And if so, it will call that interact event inside of our BP door interface. Now this is a very efficient way of adding an interact system. Because now we could even create multiple different types of actors to add this interaction system. So for example, I could add things like a light or lamp that we could interact with, and we could turn on the light, toggle it on or off. I could also create things like a vehicle system so that when I interact with the vehicle, I could drive it, or I can create things like item pickups so that when I interact with the item pickup, it will add the item to my inventory. So basically we can use the Same exact input key. And we can use all the same logic and the same interface event for multiple different actors that we want to interact with. So it's a very reusable and flexible, and we're going to actually implement a lot more different interactable actors with this same interface here in a second. But now let's go ahead and I'm going to show you guys firsthand the differences between casting and using interfaces. So if we go into our content drawer here. I docked this in layout. You can see that we now have these two different door blueprints. One of them uses casting and one of them uses interfaces. So the difference with casting is if we open up our BP door casting. So whenever you use this casting node, if you hover over it, you can say that note, this will cause the blueprint to always be loaded, which can be expensive. So basically, whenever you use this node, It will load that blueprint, whichever you're casting to. So in our case, the third person character, it's going to load that into memory, which is not ideal. So for example, if I had multiple different types of weapons or items, if I had different AI, if we're casting to all those different types of objects, it's going to cause that blueprint to always be loaded in the memory. And so what you end up is when you're using casting in your game, you're going to end up loading your entire game when you click the play button, because you're casting to the character, you're casting to this object, you're casting to this AI. You're casting to this item. And what it ends up doing is it ends up loading your entire game in the memory, even when you're not using certain items, certain weapons, or interacting with certain AI. So the cast note is very dangerous because it creates this hard reference. And it loads it in the memory. And there's two different ways of visualizing this. So if you go to your third person map and in the content folder, we have two different methods. We can use the size map. We're going to also use the reference viewer. So if you right click this BP door casting, You can see that we have a reference viewer, and we have this size map. Now first let's cover the reference viewer. So if we click on that, it will open up this new tab called the reference viewer. And basically this is sort of like a graph. You can scroll in and out, you can use the right mouse button to pan around. And over here we can see we have these different nodes here on the graph. So the first thing that you should note is, this is our BP door casting. So you can see this is our game, blueprints, BP, door casting. And you can see we have these arrows that point to these other different assets. So we have first the standard macros, so we're referencing the standard macros library. We'll cover that later on in this video. We're also referencing things like these meshes. So we're using this static mesh door. Static mesh store frame, and that's okay. Cause we're going to need those for our door, but you can also see that we have this arrow pointing to our third person character. So because we are using that cast node, we are now referencing and creating is hard reference to our character. Now, if we compare this to our interface, if we right click and show the reference of your, for our door interface, you can see that we don't have that reference to our character. We're just referencing. Our standard macros and we have this API interact. We're referencing that interface and then we're just referencing our door and doorframe mesh. And we don't have that reference to our character because we aren't casting. Inside of this door interface. So this is one easy way to see if you are referencing other blueprints where you shouldn't be and where you should be rather using interfaces, okay? Because you really shouldn't see any other blueprints that are being referenced by your blueprint class and this is just a great way to visualize and see all the things that your blueprint is referencing. So the other thing that we want to do is we want to check and see the size map. So let's go to our door casting. If you right click and if we select the size map, this is going to bring up this size map window. And so the things that you need to note over here are the name. So we have BP door casting. So you can see that is 212 megabytes. And this is for our disk size. Okay. So this is showing the disk size. So inside of our BP door, you can see that is referencing our third person character blueprint, which is 200 megabytes. And in that character, we have things like the mannequin mesh, which is 200 megabytes. And you can see that the mannequin mesh is referencing things like these textures. You can see this as 16 megabytes, 18 megabytes. So this shows us sort of the different files that are made up of this blueprint. And so this is how much memory this BP door casting, how big it is on the disc hard drive. We can hit this dropdown and we can click memory size. And so what memory size is, is it shows us how much this blueprint will cost to load it into our memory when it's actually spawned or placed in the level. So when we're hitting play, this blueprint will be loaded into our memory. It's going to cost us 127 megabytes total. And so now you can see, we have this third person character. So because we are casting to our third person character, it's now loading this character in memory and see third person character. Okay. And then we also have things like this door mesh. So you can see our static mesh door at things like the normal map, which is 5. 6 megabytes. Then we have this door frame, which has things like, you know, the frame normal map and the material. And so you can see that this door casting is just a hundred megabytes total. And we're referencing the character because we're casting to it. Now, if we compare this to our other blueprints, to our door interface, If we right click our door interface and click on the size map, you can see that the size is 17 megabytes in memory. If we go to disc size, you can see that it's four megabytes on the disc. So if we head over to the memory size, you can see that the only thing in this blueprint door interface that we're referencing is our door, our door frame. There's a couple of different things down here, uh, but you can see they're very small, so it's hardly taking any space. Okay. But you can see the main things that make up the 17 megabytes of memory are things like these textures. So if we, again, if we compare this size map to our casting or to the size map, you can see that's 127 megabytes of memory versus 17 megabytes of memory. And that's because. In our BP door casting, we're referencing the entire third person character. So it's forcing that character blueprint to be loaded into memory. So you can see that it's taking a lot more memory than our BP door interface, which is only 17 megabytes of size. Let's go ahead and look at another example. So if we go to our third person. Folder and blueprints if we right click our third person blueprint and click a size map You can see the size map for our third person character. So it's showing our third person characters currently using 110 megabytes of memory we can show disk size as well You see that the disk size is larger because we have things like textures that are large in size 16 megabytes, 19 megabytes. So we go back to memory size. You can see all the things that this character is referencing again, things like the mesh character mesh, all the textures. Now, if we go to our third person character, and instead of using this interact event, let's say we unhook this and offer this hit actor. We do a cast to BP door interface. Or even we could do a cast to BP door casting. So say we were using a system where we're checking to see if this hit actor is a door interface, and then we're checking. And then if that fails, we're checking to see if it's a door casting. Then if that fails, we're going to cast to another class and so on. Say we were using some sort of setup like this. If I hit compile save, and if I go back and right click my third person character and look at the size map, you can see that it now references in our character this door, this blueprint, blueprint door interface. So because we're casting to it, it's now referencing it in the size map, and you can see it's loading this in the memory. So if I were to even. Delete that door from the level. And if there weren't any doors, any of these blueprint doors in our level, it's still going to load that BP door when we load up our character. Okay. Whenever our character is loaded into memory, this is also going to be loaded into memory as well. Even if we don't have any of these doors to spawn in our level. So if you can see, if we are casting the many different types of blueprints. It's just going to load all those blueprints all at once. And our character is going to be massive in terms of how much memory it's going to take because all of the different blueprints that we're referencing and that we're now loading. Okay. So it has nothing to do with it actually being spawned in our level. All it has to do is if we are just using this cast. That's forcing that to always be loaded. So that's why casting is very bad because you're going to load that blueprint into memory. You're going to create a reference to that blueprint at all times. And even if those items or blueprints aren't spawned in the level, this class, because it's using that reference. We'll force it to be loaded in a memory. So it's always best to delete your cast and instead use a interface like this. If we compile, save and go back to our third person map, right click our character and use the size map. You can see that we now cut down our memory size. And we got rid of that reference to that door blueprint. So hopefully by now you understand that casting is very bad and you visualize firsthand how casting can affect the memory and loading of other blueprints in your project. And now you have a very good method of checking certain blueprints to see if they are referencing other blueprints also to see how much memory it takes on the disc and during runtime. Okay. So a very useful tool again is to use that reference viewer. And the size map because that will show you if those blueprints are referencing other blueprints that are unnecessary and don't need to be referenced. And again, if you use interfaces instead of casting, when you design your game or your project, you're not going to have to worry about hard referencing or loading other blueprints in memory and your project will be a lot more optimized compared to a project that uses casting. Now I want to make a quick disclaimer about casting because you as a viewer might be wondering why do they have casting inside of the engine if it's bad if it creates a lot of actors or blueprints to be loaded into memory why don't they just remove that node from the engine well it's actually not the end of the world if you use the cast node for example in some of my projects and even some of my tutorials You may have noticed that I use the cast node. For example, if you look at something like my first person zombie game tutorial, a very simple five hour tutorial where we create a zombie game, you have one item, which is your weapon. And then you have one AI that you have to fight. It's just a very simple game. And so for that specific game, I used casting because there's not a lot of content in the game itself. And pretty much. All of the actors or blueprints are going to be loaded into memory anyway, so I can cast between them, and it's just a very simple game, it's not going to have more mechanics or more different weapons, just one specific weapon, and the purpose of that game was to just teach you some of the basics of the engine. So in some circumstances, you can use casting. For example, if you have a very simple game with only a few items and one level it makes sense to use casting, it just depends on the scope of your game or your project. But again, if you were to use casting and then scale that game up, like for example, if we were to add, say, a hundred items, now you're gonna have some issues because you're gonna have all those items or multiple different ais. different weapons, different characters. And then you're going to have some issues where you're loading lots of items or different things into memory that for example, you might not be using at the current time. So obviously if you're going to have a much larger project, it makes sense to use interfaces instead for performance reasons. So we've talked about the benefits of using interfaces. Let's show you some more different examples of how to implement interfaces So that you become more comfortable with using them in your future games and projects. So we set up a very simple interaction system for our door. And we're using this BPI interact interface. So again, I want to stress the fact that interfaces are very flexible. And reusable for other different types of blueprints. So we'll go back to our blueprints folder. We're going to add a interactable light. That we can toggle on and off using the same interface event. So if we right click and create a new folder, we're going to name this to lamp and just double click and open that up. I'm going to right click and create a new blueprint class of the type actor and just name this to BP underscore lamp. We'll just double click, open that up. I'm going to actually close All of these other windows that I have open. So I should just have the third person map and our BP lamp open. And then in here we can add something like a static mesh, static mesh component. And under the static mesh, we can search for lamp. So we should have this S M lamp ceiling, and I'm actually going to rotate this. So if I press E, I can rotate this 180 degrees. So it's sort of standing up. And we have this little light bulb, but we need to add a light point light that we can toggle on and off. So select the default scene route and click the add and hit the drop down and search for point light Let's select that now. We just have to move this up so that it is placed right inside of the lamp So you can see that this is enabled or visible So if we select the point light and in the detail search for visibility We can uncheck that and that will go ahead and hide that light. Okay, so compile save that so the light will be off by default And then in our event graph, we can go ahead and set up our interaction event or interface. So delete all this, don't need all those different nodes. So again, to implement the interface that we created or interact interface, you just want to go over to the class settings. And then down here in the implemented interfaces, we can click the add and search for BPI underscore, and we have that BPI interact. So now compile and save that. Now under the interfaces, we should see that interact event. So now just double click that, and that will go ahead and implement that. On our graph. And now we can use off of here, whatever logic that we want to set up for interaction. In our case, what we want to do is we want to set the visibility of our point light to be on or off. So off of here, we're going to do a flip flop. So switch flip flop. So just like our door, a, we'll turn the light on. You will turn the light off. So we want to get our point light. On the graph and do a set visibility off of our a, we can hook this up to new visibility is true. And then off of our B we can do this to set visibility that up for the B and set this to false. So compile, save, and that's pretty much it. So if we go to our level and drag in our lamp, hit play, we can run up to our lamp and press E and you see that it turns on the light by press E again. It turns off the light. See, I interact over here. We don't hit anything, but if I go ahead and run up to the lamp and press E, it'll call that interact event, press E, it will turn it back off. And this will work for all of our other items. So if I have things like our door, I could drag in our door interface, our BP door interface, add it over here. And press play. And now you can see we can interact with our door. And also our lamp. Because they implement that same interface. And we're using that same interact logic, where we do this trace, and if that actor implements the interface, then we call that interact event. So this is very flexible because I can implement this interface, I can add it to my To any other blueprint actor. And then we can add that event on the graph and we can program in different interactable logic. So if you had things like a chest. You could animate the chest opening up or close. If you had things like a car, you can set up the interact event for that car. So you could drive the car. You could also do things like set up different weapons on the ground or items that you can pick up so that when you call that interact event on the item, You'll go ahead and add that item to the player's inventory. So there's a lot of different things that you can add by just using that same interface event and implementing it in whichever blueprint or actor that you want to interact with. And again, the neat thing about this is if we go to our lamp, right click and look at things like the reference viewer, you can see that it's referencing things like our standard macros. Our interact interface, the lamp mesh, this little light error texture, but it's not referencing our third person character. And again, if we go to things like the size map, you can see that it's just using 11 megabytes of memory. And it just has things like this lamp, a stack mesh lamp ceiling, we have the material and the texture. So we don't have things like the character. Cause we're not casting to the character or anything like that. So now you know how to use interfaces to add things like interaction. Let's actually use this interface and modify it. So we can do things like retrieve variables and modify variables between two different blueprint classes. So for example, we're going to create something like an ATM machine. And when we run up to this ATM machine, we're going to check and see our balance. And what that will do is it will check a variable on our player character and retrieve the variable information and display it on the screen. Okay. So we're going to use interfaces to retrieve variables. And sort of communicate those values back and forth. So to make our ATM machine, first we need to go ahead and import our mesh. So first things first, let's, in our content folder, Let's create a new folder for meshes. And just double click and open that up. And then you want to go ahead and download the project files in the description of this video. So I have this BP advanced file that you'll download. You just right click and do extract all, and then you'll get the extracted files. Okay. And so in here, you want to open up the ATM folder and we have this 3d model and then this texture. So just import the model into there will pop up with a bunch of settings. We just click import all, and it has all these warning messages. We can just not worry about that. So imported the mesh and the material. We can also drag in the texture. And import it in that folder and it should be done. So let's go ahead and do a file save all to really quickly just set up the material, just double click. And delete this parameter and just take our texture here and drag and drop it on the material graph. Hook up the RGB to our base color and click save. And now we should have our ATM mesh set up. So you can see we have this very simple ATM mesh. Actually delete that. But we want to go ahead and create a blueprint for this ATM. That way we can set up the interaction logic or when we check things like our balance or when we grab that variable from our player character blueprint. So in our content blueprints in here, create a new folder, and this will be called ATM and double click that. And we're going to right click and create a new blueprint class. And we're going to choose the actor type and we can just rename this to BP underscore ATM. Okay. So our ATM blueprint, double click and open that up. And in here, we're going to add a new static mesh component. Uh, that can just be our ATM mesh. And in the static mesh, the details we can hit the dropdown and choose our ATM mesh. Now we just need to add a little bit of text on the screen. So basically the text will show us our balance. Or check our player's balance, how much money the player has. So we can just use a simple text renderer. So a text renderer component, you see that it adds this text so it can move the text around. You can even rotate the text by pressing E and rotate it 90 degrees. So it faces the proper way. And we can even do things like scale the text down. So I press R I can scale this down and move it something like that. And the placement doesn't have to be too perfect. We just place it somewhat in front of the screen like that. And we can also change things like the horizontal alignment. I want to change at the center that will center align the text and we can change the text as well. We could type in balance and then I could add things like a colon and let's duplicate this text again. And move that down, move that forward. And then in this text, we can name this to press then in brackets E. So press E that will go ahead and check your balance. So compile and save, and let's actually rename that press E text. So rename this component, right? Click rename that to money amount, because we're going to change this text later on. So when the player runs up to this and presses E. We're going to change that text to show how much money the player has in their balance. So now if we head over to the event graph, we have these different events that come default to the actor class, we can go ahead and delete those. We're not going to use those, but what we want to use instead is our interact event. So if we go back, we have our interfaces, BPI interact. We're actually going to modify this interact event here in a second. Let's go ahead and add it to our BP ATM. So remember to implement an interface, you just go to class settings and down in the implemented interfaces. We can hit this dropdown and search for BPI underscore interact. I will go ahead and add it down here. So let's compile, save that double click. And now we'll go ahead and implement that interface. Now, what we want to do is we want to add some sort of money variable to our character. So that we can pass it to this ATM. So let's go to our blueprints actually down in the third person. We want to go to blueprints and open up our third person character and down here in the variables, we can add a new variable and this will just be called money. We want to change the variable type to an integer pile and save that. And then we could set this to maybe like 400, 400. So that's our player's current balance. So we have this integer variable inside of our third person character. How do we actually retrieve variables using a interface event? So for example, when I go up to this ATM machine, and if I press E If it implements that interact event, this event will get called. But how do I actually pass variables through this interact event? Well, there's many different ways of doing this. So if you go to this interact event, we could select this interact event function, and we could add things like inputs or outputs. Now, because we're using this as an event, we're only going to use inputs. So if I edit input here, I could change this. The type integer, and I could, you know, rename this to money, right? So that could work. Now, if I go back to our BP ATM, you can see that we have that input. So we can now fetch that variable. And in our third person character, if we go to that interactive event, I can hook up our money variable to that money and put right there now that would work. But the one thing about this is in our lamp BP lamp, you can see that we now added that pin money. And we're not even going to be using that in this blueprint lamp and even things like our door blueprints. So if I open that up, you can see that I added that pin input there, and we're not even using that input there. So you can see, we could add like a bunch of different variables to this event. But for things like these doors and these lamps, they're not going to be utilizing some of those variables. So how do we utilize interfaces in a way that doesn't just pass every single variable that we want into other different blueprints that don't necessarily need them. So one way that we could handle that is if we go back into our BPI interact, instead of passing A variable input of the exact variable that we want. We could just pass a reference to our character. So if we hit this dropdown, we can search for character and we want to add just a normal character object reference. Okay. We don't want to add a third person character reference. We just want to add a normal character object reference, and then we can rename this to character ref, so compile and save. And now, if we go into our door interface, you can see that we now have that character reference, and This is just a normal character object reference. Okay. This is not our third person character, but now what we want to do is actually want to create a second interface to retrieve things like money. So let's go into our content folder and in our blueprints interfaces. When a right click and create a new blueprint, blueprint interface, and this will be called the BPI underscore character. Okay. So this will be our interface just for our character blueprint. Let's do file, save all, and let's double click and open that up. And in here we can add a new function and we can name this to get current balance. So this will get our current balance. And then in the details here, we can just add a single output. And we can change this output type to an integer. And now we can rename this to money. So compile and save. So now you can see on the graph, we have this get current balance, and we have this return node, which has the output of this variable type integer, and it's named money. So we go to our third person character. We can now implement that BPI character interface. We'll go to class settings. Under the implemented interfaces, we can add the drop down and search for BPI underscore, and we can select our character interface. So now if we compile and save, you can see down in the interfaces. If we expand that. You see, we have this get current balance. This is a interface function. If I double click that, you can see that it opens up this function, get current balance, which has its own little graph, similar to any type of function that you would create inside of a blueprint. So in our case, we have this get current balance, and then we have that return node, which outputs the money. So we can just hook up our money variable and return that like, so. So compile and save. And now what we can do is now that we implemented that interface or BPI character, we've implemented this function, get current balance. Now we just need to call this function, get current balance off of our character. So if we go back to our BPATM, Now off our interact event, because we have that reference to the character that is calling this interaction, we can call that get current balance interface. You can see it's BPI character and get current balance message. And now you can see we're calling this interface off of that and returning this variable. Which is the balance. And this is super helpful because now we don't need to use or add multiple different variables in this interact event. We don't have to make it very cluttered with all of the variables that we want to pass through. We can instead add functions inside of our BPI character interface. That will return the specific variables that we want. And then in those blueprints, we can call those interfaces and retrieve those variables when we need them. So now with our ATM. What we want to do is we want to display our balance on the screen. So we basically just want to set this money amount. It's text render component to the balance that we retrieve right here. So to do that, we can get our money amounts components and do a set text. We have the set text function. So select that, hook that up. Like, so. And then for the value, we need to do a little bit of formatting. We'll drag over here and do a format text. And for the format, we want to do a money sign, dollar sign, and then we want to add squiggly brackets and put our cursor in the middle of the squiggly brackets and type in money and press enter. I'll go ahead and add a pin. Basically it will format the text, the dollar sign in front, and then whatever we input into this pin will be. Right here. So we want to take this integer and we want to do a two text. So we have this text to text integer, and now it converts that integer into a text value. And we can plug that into our money like, so, so compile and save. Now, if we browse to this item, or if we go to our blueprints, ATM and drag this into our level, Let's go ahead and I'm going to test this out and show you guys one thing. So I go and press E. You can see that it's saying our balance is zero. Okay, so why is it saying that our balance is zero? We go to our third person character, select our money. You can see that our balance is set to, uh, 400. So why is it that is showing our balance is zero? Now, if you go back to our third person character and to the event graph, You can see that we're calling this interact event, and we don't have anything hooked up for our character reference. So what it's doing in that ATM is it's trying to call this interface, but it's failing to do so because we don't have a reference set up. So off this character reference, we want to do a get reference to self. And now we're passing the reference of our character over to whatever thing that we're interacting with. And then in that blueprint in ATM, Because that reference is now valid, we can call that getCurrentBalance. And that will return the money variable and set it on the screen. So now if we hit play, you can see that our balance is 400. So again, if I hit play, you can see, press E, interact, and it shows our balance is 400. So that is essentially using Blueprint interfaces. And how you can use interfaces to retrieve things like variables from one blueprint and communicate them to another. Okay, and that's how you would want to set things up. That way you don't add multiple different inputs and send variables that you don't want to send to other different blueprints, okay? Cause again, we're only calling this function inside of this ATM because we only want to know about the balance inside of this blueprint ATM. So now we know how to use interfaces to get values. How do we use interfaces to modify values? So for example, say we want to create something like a slot machine. So basically when we go up to the slot machine, If we spin the wheel and we'll go ahead and take 50 from our character's balance. So we want to subtract 50 from our character's balance or from our character's money. So how do we go ahead and modify variables inside of our character using blueprint interfaces? Let's go ahead and show you guys how to do that. So first things first, let's actually go ahead and set up our slot machine blueprint. So we're going to use a little mesh. So in our meshes here, let's actually organize this a little bit further. I'm going to make a new folder for slot machine that we'll click that. And you want to go again to the project files that you downloaded from the description. And we have these three different meshes, the jackpot, I put handle and jackpot wheel. The texture, we can select all these and drag and drop them and just click import all it again. It pops up with a couple of warnings. We can ignore that. And now you should see it imported everything that we need to do file save all. So we have all the materials and all the textures already set up. So now we just need to set up the blueprint for this little slot machine or this little jackpot machine. So in our blueprints, let's right click, create a new folder. I'm going to rename this to slot machine and double click, open that up. I'm going to right click and create a new blueprint class of the type actor. And this will be called BP underscore slot machine. Okay. So double click and open that up. Okay. So in here, let's go ahead and set this up. Let's add a static mesh. And this can just be the base of our little slot machine. So under the static mesh, we can search for a cube and you might not have some of the stuff down here. So if you don't have some of these static mesh cubes, you can go to this little gear icon and click on it and click show engine content. They click the little check box. It will give you some extra. Uh, different meshes that you can pick from. And so in my case, I'm going to choose this cube 03 down here. And so we have this red cube. And this would be sort of a base of our little slot machine and add another static mesh component. And this can be our slot machine mesh. And for this static mesh, we can search for jackpot. It should be this jackpot static mesh right here and move this up. It's something like this. Let's actually drag this into our level. So if we browse to it, In our content browser and drag it out into the level like that. That should be good. Something like this. I think it's a good scale of size. So in here, I'm actually going to take this base and press R to scale it up, make it a little bit wider. Okay. Something like that. Now for our slot machine mesh, we need the lever and then we need all the wheels. Let's go ahead and add another static mesh component. This will be the jackpot lever. And under here we want to search for jackpot, yeah, jackpot handle. So select that and let's reset the location. So if it's parented, if this mesh is parented under this slot machine mesh, self underneath that we reset the location and we'll be right at the location, same location as the slot machine mesh. Okay. So it'll be in the exact spot that we need it. Now for things like the wheels, let's select the slot machine mesh and add another. Static mesh. This will be wheel 01. We can hit the drop down and search for jack. And we have jackpot wheel. So select that. Reset the location. You're going to see that it puts it up there. So that's good. And then go ahead and duplicate this again. Wheel 2. And if we move this over. Like that. That should be good. And then duplicate this one last time. Wheel number three, and we can move this one over here. So we have the wheels, which are separate meshes. You can see if I press E, I can rotate it. We have sort of this material on it, and then we have this lever, which if I rotate, you can see it goes up or down. A very simple, uh, blueprint here that we created. We could add a little bit of text here by just adding a text render text renderer component. I can just pull this out, rotate this and move that like so, set this to a center, align the text. And I just want to say something like 50 to spin. Okay, something like that. So now let's actually program the logic for this. So, we can add a little simple animation for now, that way when we interact with this, it has a little animation that plays. So, first of all, let's go ahead and go to the event graph and delete all these nodes. So we want this BPSlotMachine to have the same interface that we used, our BPIInteract. So we want to go again to the class settings, and under the implemented interfaces, add our BPI underscore. Interact interface, I'll save. And then under the interfaces, we can double click our interact events to implement that. And, and basically let's set up the logic first for our slot machine. So first thing that we want to do is for the slot machine to work. We want to check and see if the player has at least 50 to pull the lever. So we want to use our BPI character, get current balance interface function. So in our slot machine graph, we can drag off here off of our character reference and do a get current balance. So we have that interface that we created to get current balance message. That will retrieve how much money the player has. So then off of here, we could do a check. We could say, check and see if this is greater than or equal to, and we can put in 50. So 50 is the amount of money that it costs to spin this wheel. And then off of here, we could do a branch. And so that adds a little check. So we're just checking to see if the player has enough balance to spin the wheel. And then if they do, We want to go ahead and update that balance. So basically we want to take the money that the player has and subtract it by the amount that it costs to spin this wheel, which is 50. And then we want to update the balance in our character. So how do we update this money variable inside of our third person character? using blueprint interfaces. It was actually quite simple. If we go back to our BPI character interface, we can add a new event or function. So click add, this is add new function. And if we just rename this to update balance, we can just add a single inputs down here, changes to an integer and just rename this to a new balance. So compile and save. And then now in our BP slot machine, all we have to do is off of this character reference. This is the character that is trying to spin the wheel or interacting with the slot machine. We can call that new interface, update, balance, update, balance message. Let's hook that up for the true and we could add a couple of reroute nodes. So if you double click on here, the wire, I will add a couple of reroute nodes. So for our new balance, we want to take the amount of money that the player has. So their current balance and do a subtract. So subtract that by the amount of money that it costs to interact with the slot machine or spin the wheel. In our case, it is 50 and then we can plug this into the new balance. So now we just need to implement this new balance interface inside of our character. So if you go back to your third person character, Under the interfaces, you should see this update balance. So if we double click on it, we'll go ahead and add that interface event on our event graph. And now we can just set our money variable to our new balance, hook up the execution. And a new balance to our money and right there. Okay, so compile and save that. And now when this interface is called, it will set our money variable to whatever our new balance is. So if we go back to our slot machine, this is a very simple way of using an interact event. Interface using another interface to get from our character, any variables that we need in our case, it is this money integer variable. We're checking to see if we have enough balance, depending on however much this item requires. And then if so, we're updating that balance and setting that variable by calling interface event on our character. So now we could even test this out. So now if we go back into our level, let's actually delete the static mesh ramp right here. And let's move, just make sure there aren't any other actors nearby so that our overlap or interaction will properly get the right thing that we want to interact with. So let's move our ATM machine right next to our slot machine. That way we can go up to the slot machine and we can test our interaction system. It should check our balance, check and see if we have enough money. And then it will update our balance and we should be able to see it updated on our ATM. So if we hit play, interact. Right now we don't have a little spin animation, we'll add that later. If I press E you can see our balance is 350. I'll interact with this machine again. Check my balance, it's 300. Interact. Check my balance, it's 250. Interact. And Alice is now 200. So you can see that it is updating that money variable inside of our character. And it is using those interfaces to retrieve variables and to update variables using interface functions and events. So if we wanted to add a very simple animation, Let's go ahead and add those. So if we go back to our BP slot machine, we'll first add a little animation or things like moving our little lever. So we can add a little timeline that moves the lever down and back up. So in our event graph versus at a sequence. So the sequence knows allows you to have. Extra pins. So you could do this execution first and this one next, and it just keeps going down. And so they're all execute. It just gives you extra pins to fire off. In our case, we want to create a timeline. So let's add a new timeline, a timeline. And this will just be called move handle. So plug are then a zero to play from start, double click and open this up. And we just want to add a simple float timeline. So under the track at a float track, right click on the graph, add a key float curve, select that, and we can set this to zero for the time and zero for the value, add another pan by right clicking and adding a curve. This one will be a time of one second in a value of a hundred. And then if we zoom fit horizontal zoom fit vertical, you can see that we have value as zero zero one and then 100 and then right click here at the end, select that and set this to two seconds in a value of zero. Okay. So if we scroll out, you can see that it just basically goes up one second, it's at a hundred and then two seconds is back down to zero. It should give us a nice. Little rotation, our handle going down and then going back to its resting position. So now we just need to set the length right here to two seconds so that it perfectly lines up with our timeline and pile, save that head back over to the event graph, and then we just need to update the lever position. So get our jackpot lever components and do a set relative rotation. Look that up for the updates and for our new rotation, we can do a make rotator. And for the value here, we go to the viewport, select the lever. If I press E, we want to rotate it on this red axis. As you can see, the red is what makes it goes up and down like that. So that is the X. So on the event graph, we want to plug in a new track into the X or the roll. So that should animate our lever. So if I hit play and run up to it, you see that it moves down and back up to the rest of the position. Now we want to basically do the same thing for the wheels. We just want to add a simple timeline that will rotate the wheel and we can do things like rotate it at a different speed just to give it a little bit of an animation. So again we can just do another timeline, add timeline, and we'll plug this in actually to the play from start. And this timeline will be our spin wheel timeline so double click open this up. And for our wheels we're going to add the same thing, a float track. Right click anywhere in the graph, add a key, the value will be 0 and 0, and then anywhere in the graph, add another key, select that, and this will be the time value of 3 seconds, and the value will be 340 degrees. So if we fit, zoom fit horizontal, zoom fit vertical. You see that the wheel basically rotates 340 degrees, and we can set our length to 3 seconds so it matches up with our timeline, pile, and save that. Then we head over to the event graph, we want to do the same thing, we just want to get our wheel 01, and do a set rotation, set relative rotation, do a make rotator, and for the value again we want to plug this in for the X. Now we want to do this separately for each wheel, so let's add two more pins, and, and we can just copy all of this, paste it down here, so that will copy over our timeline, hook that up for the play from start, and for wheel 01, we want to switch this out with wheel 02. So if I actually drag this variable on top of this one, it will replace it, it will replace the reference with. One that we want. So again, we can copy and paste this again, drag wheel zero three, drop it on there. And you can see it updates the same as what we've done up there. And then take our sequence pin execution pin and plug that in from the play from start. So what we should see is when we spin the wheel, you should all play at the same time. So they should all spin at the same time or press E. You can see that the wheel spins at the same time and it lands on the jackpot. We could add a little bit of a variation so that they start at different times and they spin at different speeds. So in our BP slot machine, all we could do is add a little bit of a delay, a delay, add this delay node. Then for the duration, we could just drag off here and do a random float in range. Okay. And that will add sort of a random duration. So in our case, we could specify a random duration. We could say started at zero seconds or started in 0. 9 seconds. Okay. We can copy and paste this with this up or other timelines and copy and paste this one last time and hook this up or third timeline. Of course, make sure you plug it into the play from start. And we can play around with the value, like say this one could be 0. 5 seconds, this one we could say minimum of 0. 5 seconds. And maximum of 1. 2. We'll just add variations. And now if we hit play, we can see that the wheels spin at different speeds and maybe they land up at the same icon. So as a little jackpot item, you can see that we have 300, you can spin it again. We'll have two 50. We're going to spin this again and we have 200. So every time we spin the wheel, it takes away 50 from our balance. So if we spin that again, we have a hundred dollars left. Spin that again. We have 50. Then we should be able to only spin this one last time. Check our balance. We're not at zero. So if I try to spin the wheel, you see that it won't spin anymore. We're Because our balance is currently zero. Okay a very simple jackpot item and really all this thing is Demonstrating is the fact that we can use that interact event, the same interface that we have set up for all of our other interaction items. We can use the same interface that we used in our ATM to get the balance. We could do a little check, check to see if they have enough money to interact with this event. And then if so, we can update the balance by using this interface event that we call on our character, which in our character sets the money or the balance variable and updates it for the player. All right. So now we covered over interfaces and casting, and we've covered over many different ways on how to implement interfaces, whether that be on. Different objects. We added our BPI interact interface, and we also added our BPI character interface that can retrieve variables. We can modify variables and we can send them between and communicate between other different blueprints. The next part of this video, I want to talk about event tick and all the different types of ticks inside of the engine. So let's go ahead and get started. So first things first, when you create a new actor, you might have noticed that there is an event tick inside of the actor itself. So for example, if I were to create a new blueprint in our blueprints folder of the type actor, and I could just name this to BP tick and double click and open this up, dock this up here at the top, and let's actually close all of the other blueprints. We don't need any of these right now. So this BP tick, if I head over to the event graph, you can see that we have these different nodes in here. That we usually just delete when we're working on our blueprint. We have things like the event begin play. So this fires off when we hit the green play button. And if this is spawned into the level. We have things like the actor begin overlap. So for example, if someone overlaps with this actor. Currently there isn't any mesh or any collision for us to overlap with it. But say for example we had a mesh or a collision box. If another actor was to overlap with it, this event would be fired off. Then we have this event tick, which is what we're going to talk about here next. So this event tick is called every single frame if ticking is enabled. So by default, ticking is enabled. So if I were to drag off of this into a print string, I could do something like print hello. If I compile and save this, we have to drag this into our level. If I were to drag that into our level right there, you'll see that we now have it in our level. It doesn't have a mesh. So maybe we should add some sort of cube to it or some sort of mesh. So we can click add and add a stack mesh. And then in the dropdown, we could just add a cube one, compile, save that. And it has at least some sort of visual to it. So if I hit play, you're going to see that it prints off this hello, and it keeps going and going, going, going, and if I click stop, it actually keeps printing it every single frame. So you can see that it looks like it stopped, but it's actually printing over and over and over every single frame. So say your game is running at 60 frames a second. It is essentially firing this node 60 times in a second, just once per every single frame. Now the reason why I'm talking about this node is because I've seen a lot of beginners use this node for things like setting up certain logic. Or even communicating between other blueprints. And like, for example, I've seen people use this node to check and see if a variable has been updated or modified. And really I try to stay away from the event tick because this can be very expensive if you're running. A lot of different nodes and a lot of different logic off of this event tick. So for example, if I were to have a bunch of nodes strung together, like say if I was doing some Sort of complex mathematical calculation if I had a lot of nodes and logic hook up to this event tick That's going to run every single frame. So if our game is running at 60 frames a second, that's going to run 60 times In that second, and it's going to start to lag out your game and in sometimes it might even crash your game if you have just a ton of logic hooked up to this event tick. So I try my best to stay away from this tick. And if you look at a lot of my videos, you'll see that I don't really use the tick. And in fact, there's a way that you can even disable this if you don't even need it. Because if you go to things like your class defaults, if you click on the class defaults, you can see that we have a section for actor tick, and you can see it says, start with tick enabled. So if I uncheck that and compile, save. And hit play. You can see that it's no longer ticking. So this event tick is no longer calling our print string. Because we disabled that in the actor tick. And that's usually what I do every time I create a new actor. So just note, this event will tick even if you don't have anything plugged into this. You just have to disable it by unchecking this. Start with tick enable. Now there's a couple of other options. You could set the tick interval. If I were to plug that back in, I could set the tick interval to say one second, and let's go ahead and start with tick enabled. So hit that checkbox to true compile and save. And now it should be able to say print off every one second. It's actually printing off every one second. Now it looks like there's only two and that's because in our print string, if we have to drop down every two seconds is how long this message will last. So let's set this to 10 for the duration. And now we should be able to see a print off every. One second. Okay. Every one second we set that tick event to print the string. So you can do things like in the class defaults, change the tick interval. You can disable it and there's some more advanced things. You can even pause event tick and a lot more other different things. So, so again, you can compare this example back to casting. Now, why don't they just remove event tick from the engine? If people are going to use it and put a bunch of logic and it could lag out their game. Again, it does have its use case scenarios. You can use it if you'd like, like some different ways I've seen people use it is to create. Some sort of custom movement for a pawn or an actor that has to move in a specific way, like a flying actor or something like that. In those cases, some people have used EventTick for those movement logics. Also, you could use EventTick inside of C because it's a little bit more optimized running in code rather than in Blueprint. But for the most part, I would usually use timers. Or if I'm sort of creating a tick, I need to control. I'll usually use a timer. I will sort of give us the same results and we can do things like start or stop the timer and timers are something that we covered in our very first beginner tutorial, which is a very useful and helpful tool. If you need some sort of tick logic. Now that is the event tick. Now there are more different types of ticks in the engine. This is not the only type of tick. So if I, first I'm going to delete this cube from our level, so go ahead and delete that. If we go into our content browser, I'm going to show you guys the other different types of things that are ticking into the engine. So if we go into our blueprints door, let's drag out our door casting. Now with this door casting, you can see that we have this collision box. Okay. So if I open up this BP door casting, we have that collision box right here. This collision box is also a tick event. So what that means is this box is constantly ticking to check and see if there's anything that overlaps it. So whenever you have this event, you get overlap or event and overlap. That means that this box is. and currently checking every frame if there's overlap. And if you scroll down here, you can see You tick, start with tick enabled, and we have things like the tick interval. So you can see how this is basically ticking every single frame. And then if something overlaps, it will call those events. So again, these are more tick events. Whenever you have some sort of collision, that is also a tick event. All right. Now there's another tick event that most people overlook, and that is if you go into the content, third person blueprints and open up your character, we have things like input events. Okay. So these are also tick events. So for example, something like our input action, move or look, if we were to drag off here and do a print pile and save and hit play, you can see that whenever I look around, it prints off that. Hello. So again, this is actually a tick event. Because we are taking the movement from our character's mouse and for every frame we're moving and adding input or things like our camera and for things like moving if I'm moving around on my keyboard we're adding movement for our pawn and so these need to be tick events because It's what allows the player to move. And so this is just another tick event inside of the engine. So just note, there are different events that tick per frame, and you can control certain things like the overlapping tick rate. You can also adjust things like starting with tick enabled. So for some actors, like defaults, you can see it's still set to start with tick enabled. So even if we're not using that tick. Event tick inside of this blueprint. We're still starting with tick enabled. So if we disable that, it will prevent this actor from ticking, even though we don't even use it. Just note that that exists. So those are some of the ticks inside of the engine. Like I said, you can use them in some certain cases, things like movement, logic, and even I've used it in UI or user interface. Say I needed to update an icon or a mini map every single frame so that we could see where our character is moving around in certain cases, you can use the event tick again, it just comes down to your specific project and what you're going to use it for. So next up, let's talk about functions. So in our previous video, the blueprint for intermediate users, We, whatever functions with different items that we had, we created sort of this inventory system where we had different functions like a consume function, use item function, and we just briefly scratched the surface of creating functions and using them inside of the engine. Now, let's open up our third person character here and let's actually create a new function. So under the functions tab, we can create a new function and you can see that we can rename the name of our function. And basically functions are collapsed graphs where we can put in a different nodes. We can have things like inputs and outputs. Now functions are extremely useful for when you have certain nodes or logic that you want to copy and paste in multiple locations. So for example, if I wanted to have a function for healing my player or restoring some health And I wanted to use it in many different Cases. So for example, if I were to consume an item that would restore health, if I were to stand next to, say like a campfire that would restore health. In those two cases, I would want to use my heal function multiple times, and so it would make sense to put those nodes and those logic inside of a function. That way you can just call the function itself. You don't have to copy and paste those separate nodes multiple times on the graph. You can just call the heal function. There are two different types of functions. We have a pure and unpure function. Now what that means is, if we take our new function that we just created on the graph. You can see that it is this blue new function and actually that's a right click and rename this. We can name this to a on pure function. Then if we create a new function, this will be our pure function. And with this function selected in the graph or in the details, we can see we have this check box for pure or on pure. So on pure, if it's unchecked pure, if it's checked, compile, save that. And now if we head back to our event graph, If we call this pure function, you can see that it has a difference, okay? So this unpure function is color coded in blue, and a pure function is color coded in green. Now currently there aren't any pins because we don't have any inputs hooked up to this. So really quickly, let's just add a output and you can see we can specify the variable type. Let's set this to maybe like an integer, compile and save. Now you can see the pure function, it doesn't have these execution pins. That's the main difference. So pure functions are mainly for getting variables and retrieving them. So for example, we have lots of different pure functions inside of the engine. In fact, we've used some in this very video. So one example of a pure function is our random float. We have a random float in range. So you can see that this is a pure function because it's color coded in green. And all this is doing is it's returning values. Okay. It's getting random values. So we're setting a min and max value of our range and returning that value. So pure functions are more or less for getting variables and not necessarily for modifying. The values of those variables. Now, one thing that you need to note about pure functions, which is important is that they run each time per pin. So what that means is if I hook this up to a print string, so if I unplug this from the duration, let's do a random float within range, let's say minimum of zero, maximum of one, plug that into our string that will convert it. I'm gonna float to a string and let's actually plug this up for interact key. So let's go ahead and move all this stuff down. So off of our interact, we can plug this in like, so if we press E, I will print that off. And then let's also hook this up again to a print string and hook up this return value over here like so. Okay, so the pure function will be called per each pin input. So what that means is it's going to call this function once for this node, and then it's going to call once for this node. So what we should see is two separate random floats. When we print this off, okay? It won't be the same exact float because the pure function node gets called once every single time per pin connection So if I hit play and press E, you'll see that we got 0. 2 and then 0. 3, 0. 2 and then 0. 6 0. 7 and 0. 9 and you can see that both of those values that we print off are different Because the way that the pure function works is that it will be called once per connection. Well, that's very important because again, you can see things like our sphere trace here. If I unhook all of this and move back or interact input to something like our spirit trace, you can see that we have this pure function, get actor location. And this is being called three different times for our start, end, and draw debug sphere. So this node itself is being called three different times just in this blueprint execution flow. Now this could be important because say if you wanted to optimize things, you could promote that to a variable. And then instead of getting it three separate times, you could just get it once and then feed that in or these different pins. So it just notes that things like these pure functions will get called once per connection. So if you connected it up three times, it'll be called three different times. Okay. And that could also mean that it could be different values. So in the case of our random float and range, because this is a random float, right? And it's hooked up twice. We will get always two different values, no matter what. So that could be useful, or that could be an issue for your project. In which case, if you want it to be the same value, you could just promote that to a variable and then use it where you need it. So just note that. Those are the main two differences between a unpure function and a pure function. And if you want to dive even deeper, the Unreal Engine documentation has a lot of the topics that we talk here in this video. So I will leave a link to this in the description below. And it just details all of the things that we've talked thus far about functions. Now, another thing about functions is that they can be overridden. So in our functions tab, if I expand this, you can see that we have 36 overridable functions. So to override something is to have authority or say over or to nullify previous functions and logic. So for example, if I hover over this overridable functions, We have this little override drop down and this will show us all of the functions that we can override. So we have things like any damage, can jump, destroyed, end play, event hit, onJumped, onLanded, onLaunched. So for example, I could add things like a onLaunched. Launched so event on launched, we can override this function in the graph and these functions come from the parent. So we talked a little bit about inheritance in our previous video, but all of these functions are functions that are inside of either our character class or actor class. So you can see that some of these say actor, then some of these say character. So these are functions that have been created in the character class. And then some of these functions have been created in the Actor class, and then some of them have been created in the Pawn class. And because of those functions are created in those classes, we can go ahead and override them and add our own logic for those functions. Now this is particularly useful if you want to add custom logic. For very specific events. Like for example, this event and play this event is to notify blueprints as actors being deleted or removed from a level. So this is useful. Like for example, if the player leaves the game or if this actor is going to be. You can call any sort of logic off of here, for example, in my survival game, I use this node to save the player's variables and do things like a save game so that we could save the player's location, all their items. So that if they exit the game or leave the game and their character is deleted, we can save all the variables before the character is removed from the level. So there are many different functions that you can override. And depending on the class that you inherit, so for example, the parent class of this third person character, depending on your parent class, will have different functions that you can override. So again, for example, if I click this override, you can see that we have things like can jump. That's from our character class. Well, some of these other ones are from the actor class. Okay. Now, another good example of overriding functions is in our game mode blueprint class. So if you double click your game mode class, if we dock this up in the layout, we haven't really talked a whole ton about the game mode class, but we will hear hopefully towards the end of this video. But in this blueprint game mode, if we go to open or blueprint editor, it will take us to this event graph. In here we also have this own different functions that we can override. So for example, if I click this override, you can see that we have all these other different custom functions, things like can spectate, choose player, start, find player, start on log out on login on restart player. So we have all of these different custom functions. That are from this GameModeBase class. So you can see the parent class is GameModeBase. And because we are a child of that parent class, we have all these functions that we can override. And we can create our own logic for things like the game mode class is mainly used for, you know, multi player sessions and things like that. And so if, you know, a player logs in or logs out, you know, if they join the server or disconnect, You could add certain events or functions and you could add your own custom logic for that. So functions allow you to override them and reuse them and there's lots of built in functions to each class that you can use You And override with your own custom logic. Now the last thing that I want to talk about in regards to functions is the blueprint function library. Essentially functions can more or less can only be called in the class that they are in. They can be called outside of that class if you have a reference to it. So for example, if I had something like my door interaction blueprint, if I were to go inside of this box, we could have a reference to the character and then we could call any sort of function inside of it. But say, for example, I wanted a function that could be called or reused in multiple different types of blueprints or actors, like if I had a function that could be called inside of this ATM blueprint, or also this slot machine blueprint, or our door blueprint, and even our character blueprint. Say I want to create a function that can be called. wherever I want inside of my project. So in that specific case, you might want to create something like a blueprint function library, which is sort of like a library that you can add your own custom functions to, and then these functions will be callable wherever you want in any class that you want. So you can reuse them wherever you'd like. So in our blueprints folder, let's create a new folder. Or advanced. And then in here, we're going to double click and to create a blueprint function library, you want to right click and under the blueprints tab, we have this blueprint function library. So go ahead and click on that. And then we can just name this to BP underscore function. BP function library, and then just double click and open this up. And what you're going to notice is we just have a functions tab over here We have things like local variables that we can create we have this function graph Then we just have a details panel with the inputs and outputs. So it's just for purely creating functions And so we're going to create a function that can basically just print the display name of the blueprint or the actor that we are calling this function from. So I'm going to go ahead and rename this function to print actor display name. Okay. And then on our graph, we're going to use the node right click type in get class. So if you scroll down, we should have a, at the very bottom, So we have the get class. And so what this node does is it has an object. So we have to take an object reference and it gives us the object class reference of that object that we are referencing. So we want to take this object and add it as a input onto our function. So if you drag and drop it on there, we'll go ahead and select that and we'll add this input on our function. And then from this class reference, we can drag off here and do a get class display, get class display name. So the get class display name will return a string of the class name. And then off of there, we could do a print string. So that will go into the print string and we just hook up the execution pin like so and compile save. So basically this print actor display name function. We'll get the class from our reference. Get the display name of that class and print it to our screen. So rather than copying and pasting these separate nodes in, say, our different blueprint actors, we can just call this function, which now contains these nodes, and it will save us having to type, you know, all three of these separate nodes. We can just call this function and it will execute this logic. So, say we want to call this function inside our different blueprints, like this. So in our third person character, let's say if we interact and call our interact event in these different interactable objects, we browse to them if we go to them in the content folder. So first, let's do this ATM machine. If we go to the ATM, open up our BP ATM, I'll say off of the event, interact event. We want to call that print actor. And now you should see under our class, we have BP function library, and we have that new function that we created the print actor display name, and it's going to ask for an object. So this is the object reference of the actor that we want to get the display name of. In our case, we want to get the display name of this, uh, blueprint ATM. So we want to drag off here and get a reference to self. So type in self, it should say, get reference to self. And now if we go ahead and hit play, we can run up to the BP ATM machine and it should print off the name of the class. BP underscore. ATM underscore C. Okay. So it'll print off the name of the actor that we're interacting with. And we could also add this function and call that same exact function inside of our slot machine. So if we go to our BP slot machine, say we can add another pin to our sequence and then call that print actor display name node from our blueprint function library. And then off of the object, get reference to self. Compile, save, go back to our level here, and hit play. Interact, you can see that it prints BP underscore slot machine. Underscore C. Okay. So Prince, the class display name of the actor that we're interacting with. So this blueprint function library can be useful for creating many different types of functions that you need to reuse and different blueprint classes. That way it will save you time, some memory because you're just calling this function rather than copying and pasting these nodes in different locations of your project. Now, those are the blueprint functions. The next thing I want to talk about in this video are macros. So on the bottom left of our screen under the interfaces, we have this section for macros. So under the macros, we can actually create a new macro by clicking this little plus icon. And what you'll notice about the macro is sort of is similar to a function, in which case we have this sort of collapsed graph, you can see we have BP third person character. And then we have this new macro that we just created. So we can rename this macro to. win or lose. And then you can see that we have inputs in this outputs node. So it's sort of similar to a function and where you can have inputs and outputs. But in our case, the special thing about a macro is that you can have execution pins inside of this. So if I add an input, I can, what are the inputs? Change this variable type to a execution. So we have this white pin and it says execution. So if you select that, it adds this white execution pin. Okay. So this is very similar to what we see on a graph to use things like the flow of execution that gets fired off. We can use that inside of this and we can add our own execution pin inside of this macro. Now, under the inputs, we can rename this to execution and we can add another variable for an integer. And so I want to create a very simple macro that checks and sees the current score versus a score needed to win. And if our current score exceeds the score needed, then we can either call a win or lose event. So let's rename this integer here to current score. And then let's also add a new variable in our blueprint. So under the variables tab, let's create a new variable and name this to score needed. We can change this to a integer and say, you could add the score needed variable to three. And so we're going to check this current score, check and see if that is greater than or equal to, and we can get our score needed and plug that in like, so, and then off of that Boolean value could do a branch and hook up our execution like, so, and then for our true and false, we can select our output and add two outputs. And change these to executions and then we can rename these executions. We can name this to win and then the bottom one we can name to lose. And so all we have to do is plug this true into the win, false into the lose. So compile and save. And this is just a very simple win or lose macro. We're checking to see if our current score was greater than equal to the score needed to win the game. And if so, we'll call this win. Execution, the win execution, if false, we can call this lose execution. So if we go to our event graph, we can now call that macro. If we either just drag it here on the graph, or we can right click and search for win or lose. And that will bring up our macro. So now you can see our macro, it's a different color, it's color coded with this. Sort of grayish color. You can see we have that execution so we can plug in an execution node right here. And then we can program in different events or different functions to this win or lose node. We can basically have these two execution pins and call different logic. depending on if we win or lose the game. So macros can be useful if you need to use execution pins inside of a graph. And in fact, there are many other different types of macros inside of the engine that we use pretty commonly. For example, if we search for, for each loop, so we have this array for each loop, this is a macro, and we also have a four loop. So under the flow control, we have this four loop. And these are all different macros. So if we double click on this for each loop. You can see that it pulls up this standard macros, and this is actually the standard macros library. So we have this for loop, and if we scroll out here we have inputs, and you can see basically what the for loop consists of. Now we don't want to modify any of this stuff, or delete, or mess around with any of this. Because this is default to the engine. So if we mess anything up in here, it will mess with the behavior of these nodes. But this is the standard macros library. You can see, we have things like low control for loops, flip flop do once. So we have all sorts of different macros that are inside of this macro library. So again, there's the four loops. So we can double click on that and you can see what the four loop consists of. And so these macros are more or less just collapse wraps with more different nodes. And you can add things like multiple executions. You can see we have this execute loop body and completed and same with this for loop. Okay. Now there is a downside to using macros when you compare them to using things like functions. So if you use things like macros, they are more expensive in terms of performance. And the reason why that is, is because when you use a macro, it's essentially like if I were to copy and paste the same nodes inside of this macro in any part of the graph. Macros are basically just copy and pasted nodes. So your game is compiled. Now runtime unreal engine just takes the notes that are inside of the macro and just copies and paste it into your blueprint, wherever you're using the macro. And so they aren't really the same as functions, whereas a function has its own scope. And when you call a function, it will call. That function and the nodes inside of it, whereas the macro is just copied and pasted nodes and has the same scope as if these nodes were just on your event graph. Okay, so in my opinion, I would rather use functions as much as possible. And I don't necessarily, uh, create my own macros. I use things like these for loops and for each loops. You can use things like this, but I don't necessarily create my own macros or utilize them more than I do, uh, using functions. Now there is another thing with macros. You can create things like a macro library. So we saw things like the standard macro library that has all of the standard macros that we saw, like the for loop and for each loop. You can also create things like your own blueprint macro library. And again, that will allow you to create things like macros that you can use or call in any of your different types of blueprints. Now the last thing that I want to cover in this tutorial is debugging and testing out your blueprints. And also visualizing them. So there will likely come a time when you are using the engine and you're running into some sort of issue. You don't know exactly where in your blueprint code you're experiencing that issue. And so there's many different types of ways that you can figure out and debug or find the issue inside of your blueprint code. So let me go ahead and just delete all these other events and move all this stuff down. So we have this interact event that calls a trace. And calls our interact interface on whatever we interact with. Now, if we go to something like, say, our slot machine. If we browse to this asset and double click and open this up. We can actually visualize this graph in action. Okay, when we play the game. So, inside of this blueprint. Class and inside and any of the blueprint classes, you may notice we have this green play button up here at the top. So if you hit that play button, it will launch a standalone window of your game or your project. And in the background, you're going to notice two different things. You're going to notice we have this yellow outline and you'll notice it says simulating. So what that means is it's actually simulating our game or this blueprint slot machine. So it's simulating this because it's actually spawned in our level. So you see our slot machine is spawned in the level and so it'll automatically find that blueprint slot machine. So up here, if you click this dropdown, you can see that select an object to debug. If set to none. We'll debug any object. So if you hit this dropdown, you can say no debug object selected, and we have this slot machine. So if you hover over that, you can see the path to this object. So it's in the third person map, persistent level, BP slot machine. So this is the same exact slot machine that is currently spawned in our level. So now see what happens and pay attention to the graph that says simulating when we interact with this. So if I press E You can see on the graph, the flow of the execution nodes as they are being fired off. So when I call that interact event, you can see, you can see the nodes firing off and it's calling all of these separate timeline nodes to move things like the handle wheels. And all that stuff is a very helpful way for visualizing the flow of the execution inside of your code. And this can also be very useful for debugging and trying to figure out why you might have some sort of issue with your blueprints. Now, the most common way of debugging blueprints that most people use are print strings. Those are probably the primary thing that people use to debug their code. If we were to add a print string, say for this move handle, we can offer this, we can do a print string. We could say something like move handle logic, and then we could copy and we can add one over here. We could say we're moving the wheel, doing this, we're doing that. And basically that will tell us in our code whenever it's executed. So I press E, you can see it says move handle logic. And so because it's past that point and printed off, we know that the execution fired this note off and says move handle logic. So this is a way that you could figure out to where the execution is flowing and where it's stopping. And this is probably one of the most common ways that people debug their code. Now, there's a more useful way of debugging your code by using things like break points. So essentially a break point allows you to call specific nodes on your graph at run time. And it allows you to pause the execution flow or resume it to see in real time what is being executed on the graph. So for example, if I wanted to right click this update balance in this little menu, if we go down, we have this break points and we can click this toggle break point. Now if we go ahead and hit play, and if you look here on the graph, when I hit play, if I press E, you can see that. It pulls up our graph, and it will pause the execution right on the node that we toggled the breakpoint. So you can see the execution, it will show us the flowing lines, and it will show us that this node is where the execution will stop. Now, one useful thing is we can go to the next node in the graph. We have these little arrows. So we have things like locate the current active node. So that will find the active node. In this case, we have this arrow also pointing to it. We can continue the execution. So that will resume our game, fire off the rest of execution. If I press E again, you'll see that because we have that break point enabled, it will pause it there. You can do things like go to the next node and you can see it fire off. And then we have stepped out of the next node to be executed in the parent graph. Okay. So we can add multiple different break points in your code. And this is very useful for visualizing execution flow and finding where you might have a problem. with your blueprint code. Now to disable this break point, you can right click and you can either disable break point. So if we were to hit play and run through this again, you can see that the logic will flow freely, but we can also remove the break point. If we are done using it. And of course you have a hotkey to toggle the breakpoint. Now there's another very useful thing for debugging blueprints. And I find this very useful for visualizing things like variables. So for example, you have this event update balance. So if we right click on any pin on our graph of any variable, we have this little menu and under the watches, we have watch this value. So if we click on that. We have this little icon. So we, we are now watching the value of this variable. So whenever this event update balance is called, we should be able to see the value of this variable. So let's hit play. And then the first thing that we need to do is we need to actually select debug object. So right now you see no debug object selected. So if we hit the dropdown and we have this BP third person character spawn, this is the character spawn in our level. And so now is we are watching. Integer new balance zero. Okay. So now watch what happens when we go ahead and walk up to our slot machine. We can see actual value of that integer. So it's 350 because we spun the slot machine once. And press it again. You can see it's 300. You can see it's 250, 200, 150, and essentially watching this value will allow us to view the value of any variable inside of our graph during runtime. And this can be very useful for checking things like the values in our array. Or checking really any variable that you have inside of either character or any other type of actor class that spawned in your level. Now, those are just some different methods that you can use to debug your blueprint. The last thing that I want to cover in this video really quickly is. The Unreal Engine class framework. Now we've messed around with different types of blueprint actors and we briefly covered over the topic of inheritance in our intermediate class. But basically I want to talk a little bit about the structure or the framework of the Unreal Engine class system. So what you may have noticed by now is we have a game mode for this template. This third person game comes with a game mode. And most projects will actually have either a game mode assigned, or if you want to use things like your own character inside of your project, you will most likely have to use a game mode. Okay. So I want to explain things like the game mode, the character class, all these different classes that some people might not be totally familiar with, whether that be you're using the engine for. Creating things like interactive experiences, games, or maybe something like films, you may or may not use the game mode class. So I'm going to go ahead and just explain everything for you real quick. So first things first, if you go to the window, you want to open up the world settings window. Okay, so by default, This window is actually not shown. So if you open up the world settings, I will go ahead and open up this tab. Now in the world settings with this third person map loaded up under this game mode tab down here in the world settings, we have this game mode override. So you can see the current game mode assigned to this level is our BP third person game mode. And if we actually expand this game mode, selected game mode, you can see we have things like a default pawn class. We have things like the character, that's our default pawn. We have this HUD class. So this is sort of like the UI class that our character might use. I don't really use this at all. And we have things like the player controller. You can see we have these default classes already signed. We have this player controller class in here. These are the default classes that are assigned to it if you don't have a custom one created. And the player controller essentially is what. Controls the character. The controller is assigned to every player who plays the game. You're going to be using them more. If you're creating things like games or interactive experiences that require multiplayer, you'll be using the player controller class because that class is where you'll be storing things like user interface or widgets. You'll create it inside of the controller class. If you're creating things like films or just a single player interactive demo, you might not use the PlayerController class at all. And then below this we have things like the GameState. So the GameState class is, again, more for the game side of Unreal Engine. So you have to remember that Unreal Engine is, or at least was, primarily a game engine. So we have things like these GameModes and GameStates. And these classes are used to store logic for a multiplayer game or you can have things like the scoring system to show things like, you know, how many kills does a certain player have, current score of the game and all that stuff. So again, these are primarily used for things like multiplayer games. So depending on your project needs, you may or may not use that class. And we have things like the player states. Again, this is. For multiplayer games, PlayerState is assigned for every player who joins the game, and you can store things in here. Primarily, again, for multiplayer games, if you're going to store stuff like the player name, the player's current score, like their KD, how many kills they have, how many deaths they have, you can store that in this PlayerState class. And then you have things like the spectator class, again for multiplayer games, if you wanted to spectate other different players, we have the spectator pawn. So this framework, where we have this game mode, this player pawn, this player controller, game state, all these different classes are reflective of Unreal Engine's game engine design. So you just need to understand that depending on the project that you are making, You may or may not need to use some of these different classes because if you're just making something like a single player interactive experience. Like, for example, if you're creating some sort of 3d environment that you need to show to your client, it doesn't need to be multiplayer, all that stuff. You may just need to use things like the third person character blueprint and none of these other different classes. But if you're creating things like a multiplayer game that has scoring match stats, kills, deaths, all that stuff, you may end up using all these different game mode classes because these are mainly things for. Creating games inside of the engine. So just understand that the framework is built mainly around making games. And so depending on your project, you'll just need to either adapt and use some of the classes, or you might not have to use them at all. So that is all for our blueprint for advanced users tutorial. We covered over blueprint interfaces and compared them to casting and we showed you the differences between using interfaces and using casting and why casting can be bad for your project. I showed you many different case scenarios and where you could implement interfaces to retrieve values to set values and call different events. And then we went over things like event tick. And all the different tech events inside of the engine we covered over things like functions, overriding functions, function libraries, and we compare them to things like macros and why you may use functions over macros. And we showed you how to debug blueprint code, how we can visualize the execution flow on our graph and how we could view things like the variable values at runtime on our graph. And then lastly, we went over things like the unreal engine game framework and all the different classes that are inside the game mode class. If you guys enjoyed this video, make sure you leave a like and consider subscribing for more future content. Let me know what you guys think down in the comments down below. Also, if you want more unreal engine content, check out my premium courses as smart poly dot teachable. com. I have a complete multiplayer survival game course. Check the link in the description if you want to learn more and yeah, that's pretty much it for this video. So I hope you guys enjoyed and I'll see you guys in the next one.
Info
Channel: Smart Poly
Views: 16,712
Rating: undefined out of 5
Keywords: Unreal Engine 5, Unreal Engine 5 Release, Unreal Engine 5 New Features, Unreal Engine 5 Next-Gen, Unreal Engine 5 Nanite, Unreal Engine 5 Lumen, UE5 Release, UE5 Next Gen, UE5, Lyra Starter Game, Unreal Engine 5 Lyra Game Tutorial, UE5 Lyra Tutorial, Unreal Engine 5 Open World Tutorial, Unreal Engine 5 Open World GamesUnreal Engine 5, Unreal Engine 5 Open World Games
Id: f-OFKpujoTc
Channel Id: undefined
Length: 128min 57sec (7737 seconds)
Published: Fri Mar 15 2024
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.