Lyra: where tf is equipment manager component initialized?

There is no initialization of equipment manager component in C++ code of the game, it’s not contained in the shooter core experience, it is not contained in shooter hero character BP. But there are multiple requests to find component on pawn with class of equipment manager. How is this possible?

Such modularity that you can’t find where component is initialized is awful.

3 Likes

It gets injected at runtime via the Experience Definition.

A lot of Lyra works that way. On the one hand it’s really amazing. On the other hand, it can be frustrating to track things down if you don’t know to look there.

So now you know. Look in the Experience Definition. :+1:

1 Like

In which one?

Look in the World Settings for whichever Level you loaded up. The World Settings for the Level defines which Experience Definition to load.

I already looked in all Experience definitions. I need an exact answer.

If you’re sure it’s not in any experience definition, then it’s on the pawn itself, which is defined in the pawn data, linked in the experience definition.

No, Pawn data can’t contain any components by its design. As I said already, it’s not on the pawn too.

I don’t actually use ShooterCore at all, so had to install a default Lyra project to track this down.

TLDR component injection can be defined in either the Experience Definition or in the GFP definition. (Anywhere a Game Feature Action can be defined).

The ShooterCore GameFeatureData asset defines an Add Components Game Feature Action. Any time you load a level that activates the ShooterCore GFP it will run this action.

It defines 6 runtime-injected components, 1 of which is adding LyraEquipmentManagerComponent to all LyraCharacter actors spawned on either the client or server.

How I found this, in case others are trying to find other things like it:

  1. Breakpoint constructor of the component in question:

  1. PIE Lyra

In the above screenshot you see during the default pawn spawning, typical Modular Gameplay stuff is happening. Runtime components are getting added to the pawn actor.

I found a list of 6 components, one of which is the one we’re looking for.

  1. I then breakpointed the Game Framework Component Manager AddComponentRequest method which is where runtime components are registered, and found that the component in question was being registered during OnExperienceLoadComplete.

  1. All required GFPs are being loaded and activated during OnExperienceLoaded, so I decided to look at the ShooterCore GameFeatureData to see what it was doing.

And voila! There is the AddComponents Game Feature Action that interests us.

9 Likes

Ok, I overlooked it in ShooterCore definition. Thank you

Amazing answer saved me.

You can use Rider to search for UGameFeatureAction_AddAbilities or UGameFeatureAction_AddComponents. You can then click on the Plugins/Content links while Unreal is running to open that asset, even the function it’s called in, from the find window in Rider. Then using the Reference Viewer you’ll have to dissect the GFD or the ExperienceDef

1 Like

My hero