Not supposed to derive from ALyraPawn?

I’m working on a GameFeatures plugin for LyraStarterGame. I know I’m supposed to be injecting functionality in via components, and do plan to work most of my pawn logic using that method, but I’d still like to derive from ALyraPawn so I can have a GetMovementComponent and some other similar type methods overridden.

When I try to derive from ALyraPawn I get tons of linker errors like:

LNK2019: unresolved external symbol "public: __cdecl ALyraPawn::ALyraPawn(class FObjectInitializer const &)" (??0ALyraPawn@@QEAA@AEBVFObjectInitializer@@@Z) referenced in function "public: __cdecl AMyPawn::AMyPawn(void)" (??0AMyPawn@@QEAA@XZ)

I added a ModularGameplayActors module dependency but it still didn’t work.

If I also modify LyraPawn.h to export the pawn like class LYRAGAME_API ALyraPawn then it links just fine.

Is there a particular reason that ALyraPawn is not exported?

Is it expressly forbidden for me to derive from it? Forcefully exporting Lyra code so I can use it seems like hacking the engine - not something I want to maintain long term.

Thanks in advance for any advice you can provide.

2 Likes

After playing with this for a while I’ve now been able to successfully derive from ALyraPawn to make my own AMyPawn.

It turns out that ALyraPawn does not implement gameplay ability system, gameplay cues or gameplay tags. All of that logic was put into ALyraCharacter instead, so it’s impossible to use Lyra for a non-character-based game without recreating the wheel.

In order to make AMyPawn that implements these features, I had to forcefully expose a number of Lyra classes and interfaces.

Given this experience I’m guessing this lack of exposure is just an oversight, as was the implementation of all this code into ALyraCharacter rather than ALyraPawn? :thinking:

3 Likes

I ran into this myself today. Seems that a lot of Lyra is set up expecting that you are using the ALyraCharacter. I have been trying to figure out how to add a Chaos vehicle instead of using a humanoid

2 Likes

I’m going to mark this as resolved. From my investigation it seems clear that Epic just accidentally released this in its current state and it’s not intended that ALyraPawn is not exported.

I documented what I did to get around this and furthermore how to implement the missing ALyraPawn functionality that really should be in the base ALyraPawn but isn’t as of 5.0.1.

2 Likes