Download

How to get reference to UGameplayEffect BP?

Hello
I can’t get reference to UGameplayEffect BP in C++

I tried:

const ConstructorHelpers::FObjectFinder<UGameplayEffect> SprintEffectAsset (TEXT("Blueprint'/Game/1TEST/IncreaseMoveSpeed/GE_MoveSpeed.GE_MoveSpeed'"));
SprintEffect = SprintEffectAsset.Object;

I got path to BP via right click → Copy Reference

I tried to add _C at the end of path, i tried to put UClass in FObjectFinder and then Cast.
None of this works.

Thanks for any help

Unfortunately I don’t think I have had the pleasure of loading a UGameplayEffect yet. . . but I intend to at some point. I noticed though that you are loading a Blueprint, and the closest I have is:

.h
TSubclassOf<UMatineeCameraShake> CameraShakeComponent;

.cpp
static ConstructorHelpers::FClassFinder<UCameraShake> CameraShake(TEXT("Blueprint'/Game/Blueprints/Common/SimpleShakeBlueprint'"));
if (CameraShake.Succeeded())
    CameraShakeComponent = CameraShake.Class;

Maybe that will be of some help. . . maybe not.

Thank you, it works

Full solution:

.h

TSubclassOf<UGameplayEffect> SprintEffect;

.cpp

static ConstructorHelpers::FClassFinder<UGameplayEffect> SprintEffectAsset (TEXT("Blueprint'/Game/1TEST/IncreaseMoveSpeed/GE_MoveSpeed.GE_MoveSpeed_C'"));
SprintEffect = SprintEffectAsset.Class;

Have to add _C at the end, don’t work without it

:slight_smile: