We could create a simple network to do a number comparison, and output the value, like so. In this way, you can define custom functionality for each Blueprint that implements the interface.įor example, in this image we see a basic Interface function as opened within a Blueprint. Whatever functionality is defined here will be unique to this Blueprint. This shows the local implementation for this function. If you Double-click that function, it will open up within the Blueprint Editor. Once an Interface has been implemented by a Blueprint, the functions of that interface will be visible in the My Blueprint panel. One of the most important aspects of Interface functions is that, since they have no implementation of their own, their functionality can be independently defined for each Blueprint that implements the Interface. If the level is loaded and valid, the Interface Message will call the function with the level's Blueprint Script as the target. Interfaces can also allow for communication between sub-levels using the Get Streaming Level node. Calling Interface Functions on Level Blueprints To specify a Blueprint that exists within the level, it is best to make a Public variable of type 'Actor', and assign the appropriate Blueprint in the value for that variable using the Details tab of the Level Editor. There is some labeling beneath the node title in place to help differentiate: The version listed under Interface Messages is designed to call the function via the interface on other Blueprints implementing the same interface. It is important to note that the version listed beneath Call Function is a local version, intended only to be called within this Blueprint. When creating an Interface Function node within the Event Graph, you will often see two versions of the function listed in the context menu. The calling Blueprint knows the name of the in-game instance of the other Blueprint. This can be done when 2 criteria are met:īoth Blueprints implement the same interface with the required function. Functions from a single interface can be called on other Blueprints. Interfaces are useful for allowing communication between different Blueprints. The functions of the Interface are executed through the use of Interface Message nodes, These look and act like regularįunction Calls, except that they can fail silently if the target does not implement Select the type of Event you would like to add and the Event will be added to the graph.Ĭreate a network of nodes connected to the Event's executable pin to give it functionality. Right-click in the EventGraph of the Blueprint and choose Add Event > Event. The nodes connected to the Event define the functionality, or implementation, for the function. This is done by placing Event nodes for the Interface functions in the EventGraph. When an Interface is added to a Blueprint, that Blueprint must implement the Interface's functions in order to have implemented in the Blueprint from which the current Blueprint was derived). The Inherited Interfaces section within the Interfaces category automatically populates with any Interfaces that were inherited by this object (i.e. In the Details panel on the right, locate the Interfaces category.Ĭlick the Add Interface button to see a list of the available Interfaces and select the Interface to use. By creating a Blueprint Interface thatĬontains an OnTakeWeaponFire function, and having both the car and the tree implement that Blueprint Interface, you can treat theĬar and the tree as the same type and only call the OnTakeWeaponFire function when either of them is shot.īlueprint Interfaces as well as Interfaces defined in native code (C++) can be added to any type of Blueprint.įrom the Main Level Editor window, open the Level Blueprint inside your project.Ĭlick the Class Settings button from the Toolbar across the top. Share one specific thing, like they can both be shot by weapon fire and take damage. This means you can have completely different types of objects, such as a car and a tree, that The use of Blueprint Interfaces allows for a common method of interacting with multiple different types of objects that all share Calling Interface Functions on Other BlueprintsĬalling Interface Functions on Level Blueprints
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |