tranek / GASDocumentation

My understanding of Unreal Engine 5's GameplayAbilitySystem plugin with a simple multiplayer sample project.
MIT License
4.26k stars 789 forks source link

Doc section 4.6.2 FGameplayAbilityInputBinds FString enum deprecation #103

Closed KagasiraBunJee closed 1 year ago

KagasiraBunJee commented 1 year ago

Hi @tranek , in the section 4.6.2 where you bind input with GAS, they deprecated constructor with FString name of enum with FTopLevelAssetPath struct. Third argument has to be FTopLevelAssetPath which constructs with path to your enum, and enum name

This is from engine header of FTopLevelAssetPath

/* 
 * A struct that can reference a top level asset such as '/Path/To/Package.AssetName'
 * Stores two FNames internally to avoid
 *  a) storing a concatenated FName that bloats global FName storage
 *  b) storing an empty FString for a subobject path as FSoftObjectPath allows
 * Can also be used to reference the package itself in which case the second name is NAME_None
 * and the object resolves to the string `/Path/To/Package`
 * This struct is mirrored and exposed to the UE reflection system in NoExportTypes.h
*/

If your enum is in main project use: const FTopLevelAssetPath InputEnumPath(TEXT("/Script/YourProjectName"), TEXT("YourEnumName")); where /Script/YourProjectName if your enum is in code, or /Path/To/Package.AssetName if your enum is in assets

If your enum is in plugin, then const FTopLevelAssetPath InputEnumPath(TEXT("/Script/YourPluginName"), TEXT("YourEnumName"));

usage:

const FTopLevelAssetPath InputEnumPath(TEXT("/Script/YourProjectName"), TEXT("YourEnumName"));
const FGameplayAbilityInputBinds BindInfo(FString("Confirm"), FString("Cancel"), InputEnumPath);

Would be awesome to update doc to fix warning on compilation for those who looking for it

tranek commented 1 year ago

I had made the change in code in the upgrade to 5.1 but didn't update the README sufficiently. Added new section in the troubleshooting for people upgrading to UE 5.1. https://github.com/tranek/GASDocumentation#troubleshooting-enumnamesarenowpathnames

Thanks for the callout.