Skip to main content

C++ API Reference

This section highlights the main C++ types you typically interact with.

Public headers

Core:

  • Public/Data/EDInteractionTypes.h

Components:

  • Public/Components/EDIPlayerControllerComponent.h (UEDPlayerInteractionComponent)
  • Public/Components/EDInteractableComponent.h (UEDInteractableComponent)
  • Public/Components/EDInteractionGameStateComponent.h (UEDInteractionGameStateComponent)
  • Public/Components/EDInteractionFragment.h (UEDInteractionFragment)

UI:

  • Public/UI/EDInteractionWidget.h (UEDInteractionWidget)
  • Public/UI/EDInteractionViewModel.h (UEDInteractionViewModel)

Utilities:

  • Public/Library/EDInteractionLib.h (UEDInteractionLib)

Interfaces:

  • Public/Interfaces/EDInteractionNotifier.h (UEDInteractionNotifier / IEDInteractionNotifier)

Settings:

  • Public/Settings/EDInteractionSettings.h (UEDInteractionSettings)

Key runtime ownership

  • UEDPlayerInteractionComponent should be owned by a APlayerController.
  • UEDInteractionGameStateComponent should be owned by AGameStateBase (server authority).
  • UEDInteractableComponent should be owned by interactable actors.

Typical usage patterns

Start/stop interaction from code

if (UEDPlayerInteractionComponent* Comp = MyPC->FindComponentByClass<UEDPlayerInteractionComponent>())
{
Comp->Interact(true);
}

Listen to interaction events on an interactable

InteractableComponent->OnInteractionSuccessful.AddDynamic(this, &AMyActor::OnInteracted);

Implement the notifier interface

Implement UEDInteractionNotifier on your Pawn or PlayerController to receive centralized callbacks.

Example callbacks:

  • Local_OnInteractionDenied
  • Local_OnInteraction
  • Server_OnInteraction

MVVM extensions (fragments)

Derive from UEDInteractionFragment and return a UMVVMViewModelBase* from OnInteractionStarted_Implementation.

The returned ViewModel is registered on the base UEDInteractionViewModel and can be retrieved by class.

Settings access

const UEDInteractionSettings* Settings = GetDefault<UEDInteractionSettings>();

Server validation selection

The server validation policy is driven by:

  • Settings->ServerInteractionValidationType

And executed inside:

  • UEDPlayerInteractionComponent::TraceValidationActor
  • UEDPlayerInteractionComponent::TraceValidationFoliage