Skip to main content

Creating an Effect (C++)

Minimal custom instance

Create a class derived from UEDInteractionEffectInstance and implement at least one of:

  • OnStart_Implementation()
  • OnTick_Implementation(float DeltaSeconds)
  • OnFinish_Implementation()

You can also implement the Blueprint-facing entry points by calling the base implementation (which triggers ReceiveStart/ReceiveTick/ReceiveFinish).

Example:

#include "Effects/EDInteractionEffect.h"
#include "Components/PrimitiveComponent.h"

#include "MyEffectInstance.generated.h"

UCLASS()
class UMyEffectInstance : public UEDInteractionEffectInstance
{
GENERATED_BODY()

protected:
virtual void OnStart_Implementation() override
{
const FEDInteractionEffectContext& Ctx = GetEffectContext();
if (UPrimitiveComponent* Target = Ctx.TargetComponent)
{
Target->AddLocalOffset(FVector(0.f, 0.f, 2.f));
}
Finish();
}
};

Effect settings class

Create a class derived from UEDInteractionEffect and provide an instance class:

#include "Effects/EDInteractionEffect.h"

#include "MyEffect.generated.h"

UCLASS()
class UMyEffect : public UEDInteractionEffect
{
GENERATED_BODY()

public:
UMyEffect()
{
Channel = TEXT("MyEffect");
InstanceClass = UMyEffectInstance::StaticClass();
}
};

Then add UMyEffect to the arrays in UEDInteractionEffectsComponent (or per foliage via FEDFoliageEffectsInfo).