Somebody know FTopLevelAssetPath of 5.1?

I am learning GAS using version 5.1 , The old binding was an enumeration name,But now it’s FTopLevelAssetPath,Passing enumeration names crashes,What ishould be passed to bind now BindAbilityActivationToInputComponent()? :melting_face:


Have same issue. Probably FTopLevelAssetPath needs correct enum path name. Did you solved this problem?

You can use it like this
FTopLevelAssetPath(GetPathNameSafe(TEXT(“/Script/Youprojectname”),TEXT(“EDGAbilityInputID”)).
But it doesn’t respond to input ,because now Enhance Input,ues UInputAction. Not the old version of the input.
FGameplayAbilityInputBinds Cannot be associated with UInputAction of the enhanced input. in the FGameplayAbilityInputBinds stack are key names and enumerations mapped to input Settings. :sob:

3 Likes

If the Enum is inside of a plugin, it should be TEXT("/Script/YourPluginName"), if it is inside the main project, TEXT("/Script/YourProjectName")

Full line:
FTopLevelAssetPath InputEnumPath = TopLevelAssetPath(TEXT("/Script/YourProjectName"), TEXT("ESAMPLEAbilityInputID"));

Then:
const FGameplayAbilityInputBinds Binds("Confirm", "Cancel", InputEnumPath, ConfirmInputID, CancelInputID);

If the path or the enum name is wrong, you will get a crash.

3 Likes

If anyone wishes to locate all asset files associated with their target class, the following code offers a concise and effective solution. It requires the initialization of FTopLevelAssetPath with the appropriate PackageName and AssetName:

const UClass* AssetClass = UWFActionTemplate::StaticClass();

// Get the Asset Registry Module
FAssetRegistryModule& AssetRegistryModule = FModuleManager::LoadModuleChecked<FAssetRegistryModule>("AssetRegistry");

TArray<FAssetData> AssetData;
FARFilter Filter;
FName PackageName = *AssetClass->GetPackage()->GetName();
FName AssetName = AssetClass->GetFName();
Filter.ClassPaths.Add(FTopLevelAssetPath(PackageName,AssetName));
AssetRegistryModule.Get().GetAssets(Filter, AssetData);