Unreal Engine - Blueprint Interfaces Tutorial

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
what's good everyone today i've got a video for you which just may change the way you go about your blueprinting yes today we're covering blueprint interfaces why you'd use them how you'd use them when you'd use them all that good stuff but before we get into that a very quick thank you to all my patreons for your continued support you guys rock so a blueprint interface is amazing as it allows you to communicate with other blueprints without a direct reference so what does that mean well you know those times when you've been trying to call a function in a blueprint and you end up using a cast to blueprint node to call it well a blueprint interface allows you to call that function without locking yourself directly to a single blueprint that you're casting to so let me give you an example so let's say when someone overlaps our box collision we want to call the event bingo here we have our old casting method and here's the same setup but with the blueprint interface so why would we want to use our blueprint interface method rather than the casting method well for two main reasons the first that with casting we lock ourselves to one single blueprint in this example the third person blueprint what if we wanted to call the function bingo to a variety of different blueprints well with blueprint interfaces we can call the bingo function to any blueprint in the project whatever kind of actor that we overlap with our box collision would receive the event bingo as long as it's using the interface the second reason is that every time you directly reference a blueprint you link them together meaning when one is loaded the other one is loaded regardless of if it's being used with modern day pcs this honestly isn't too much of an issue but if you have thousands of linked together blueprints it will slowly build up so let's be efficient when we can so the answer to why you use a blueprint is that it allows you to send messages to multiple blueprints without a direct reference the second is that it prevents hard referencing this may seem confusing but don't worry it'll all make sense at the end okay so we know why we'd use a blueprint interface now how do we use them well we can create one by right clicking in our content browser going under blueprints then selecting blueprint interface let's double click to jump inside it so this is where we can create all our different functions and the functions work just the same as a normal function where we can add inputs and output variables down at the bottom so let's click the arrow in the top right and create a new function and call it trigger event example now we can add this function to any blueprint we want all we need to do is hop into the blueprint so let's jump into our third person character then go over to class settings click add interface then add your interface now after you compile you can see all the interface functions you've implemented on the left under interfaces so now we can either right click and implement trigger event example or just right click in the event graph type in trigger event example and bring in the event if you made a function with an output in the interface it will appear silver these functions can't be pulled into the graph but they can be made by double clicking on them here you can pass variables or certain information to the blueprint calling the function okay so we've already brought in the event but now let me show you how we can call that event so let's say we have a blueprint with an overlap box we've made an on component begin overlap for our box trigger now we can pull off the actor reference and call our trigger event example message now whenever an actor overlaps this trigger box it will trigger the trigger event example function in their blueprint as long as the actor has the blueprint interface in the class settings and has the event in their event graph okay so that's how we can use blueprint interfaces now let's go over some examples to bring all of this stuff together so when would you use a blueprint interface well you would use one every time you need to send a message to a blueprint but you don't have a hard reference and you don't want to create one so we can send messages to a huge range of different blueprints using these nodes as an indirect reference this is a great way to call a function in any of these blueprints we can also use any node which gives off an active reference to send events things like line traces on component begin overlaps or on here literally any trigger which gives an active reference we can use another time you may want to use a blueprint interface is when you want to call a function to a variety of blueprints but you don't know which one you want to send it to until the game started so in our character let's say we want to pick up a range of item blueprints we can use a key press to trigger the pickup then we can scan all the overlapping actors with our character and if any of the actors are implementing the interface we can send them our blueprint interface function telling them to get picked up now this wouldn't work with casting as when we begin play we have no clue which blueprint we want to pick up so we can't directly cast to it okay now a few examples of where i've used blueprint interfaces in my marketplace asset in my game mode i have heaps of normal events this is to prevent the game mode linking to multiple objects increasing memory in my character i have an is a live function letting my other blueprints quickly know the status of my character i have a simple trigger event called increase xp meaning when enemies die they can pass over their experience extremely easily and that my friends is everything you need to know about blueprint interfaces to start using them so i hope this video has helped you out i've been your host beardman and as always thank you for watching and supporting the channel stay awesome catch you in the next one [Music] you
Info
Channel: Beardgames
Views: 49,200
Rating: undefined out of 5
Keywords: Epic Games, Unreal Engine 4, Unreal Engine 5, UE5, unreal engine, ue4, Beard games, Beardgames, unreal engine 4, unreal engine 5, epic games, ue5, gamedev, unreal engine 2020, game dev, game developer, indie gamedev, Indie Game, unreal engine blueprint interfaces, ue4 blueprint interfaces, ue5 blueprint interfaces, unreal engine bp interface, ue4 bp interface, ue5 bp interface, ue4 blueprint communication, ue5 blueprint communication, unreal engine blueprint communication
Id: 96vJiKrAa9k
Channel Id: undefined
Length: 6min 13sec (373 seconds)
Published: Sat Feb 12 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.