This is an Interaction System for Unreal Engine 5; It handles player interaction with any interactable world object.
- Pretty much plug and play; All logic is ran from a single actor component
InteractionComponentand a interfaceInteractionInterface - Uses interfaces; So no need to reparent any of your existing actors to a base interactable class
- Easy to use; Straight-forward with no bloat
- Blueprint accessable; No code required
- Uses timers; Not tick
- Clean and commented
- Not network replicated
- First thing you need to do is add the
Interactioncomponent to your player character/pawn
- Once the component has been added; tweak the settings to your liking
- Add the
InteractionInterfaceto any of the actors you wish to be seen as anInteractable
and thats it! You're now all set and can start using the interaction plugin!
Using the plugin is very simple; all you need to do is call StartInteractionTrace() and it will start tracing for interactables (if you have bStartOnBeginPlay set as true you can skip this).
If we hit an Interactable then it will update the TargetActor variable in the component
Stopping the trace is just as easy; Just call StopInteractionTrace() and the trace will forget the TargetActor and stop.
We can interact with our TargetActor by calling the InteractWithTargetActor() function. This will simply check if the TargetActor is valid and has the InteractableInterface then interacts with it.
There are a few Delegates that you can bind too when certian things happen from within the interaction system.
Fires when the trace hits a new actor and updates the TargetActor in the component
Fires when the TargetActor has been forgetten or replaced
The InteractionInterface is how we can detect Interactables without having to convert any actors to a child of a base interactable class. Just add this interface to any actor you want to be deemed as an Interactable and the component will do the rest!
The InteractionInterface has a few functions which you would need to override so you can select funtionality dependant on the actor it is overridden in.
Interact() is what gets called on the Interactable when InteractWithTargetActor() is called. This is the bare minimum needed for the Interactable to work.
Not as important; but there is also BecomeTarget(). Override this and you can add funtionality for when the Interactable becomes the TargetActor
Not as important; but there is also ForgottenAsTarget(). Override this and you can add funtionality for when the Interactable is no longer the TargetActor
This plugin is licensed under CC BY-NC 4.0.
You can use it for free in commercial and personal projects, but you cannot sell or distribute this plugin or any modified version of it.
See the full license: CC BY-NC 4.0













