常见配套:AbilitySystemGlobals 与插件依赖

GAS 有几个"不配也能跑、配了少踩坑"的全局设置,集中说明。

AbilitySystemGlobals(全局设置)

在 DefaultGame.ini 里:

[/Script/GameplayAbilities.AbilitySystemGlobals]
bUseDebugTargeting=false
GameplayEffectDurationMultiplier=1.0f

常用设置项: - AbilitySystemGlobals 的 GetGlobalTags():全局"恒有标签"(如所有角色都有 Character.Hero),省去处处检查; - 预测有关设置(PredictionKey 相关):初级项目保持默认。

插件依赖关系

GAS 分拆成几个内置插件,按需启用:

插件 内容 必需?
GameplayAbilities GA、AbilityTask、GAS 核心 必需
GameplayTags 标签系统 必需
GameplayTasks 任务系统(AbilityTask 基础) 必需
GameplayEffectExecutionCalc(内置在 GameplayAbilities) 自定义执行 按需

在 .Build.cs 里加模块:

PublicDependencyModuleNames.AddRange(new string[] {
    "GameplayAbilities", "GameplayTags", "GameplayTasks"
});

TargetData 与"配套"零件

第 4 章会讲 TargetData(技能目标数据),它依赖: - GameplayAbilityTargetActor(场景里生成、可配置的目标选择器); - TargetDataFilter(过滤规则)。

这两个都是 GameplayAbilities 模块内置,不需要额外插件。

常用的配套插件(社区)

  • GameplayDebugger / AbilitySystem 的 showdebug:内置调试(重要,见下);
  • Niagara 与 GAS 的连接:属性变化通知驱动特效(不依赖额外插件,通过委托)。

showdebug:GAS 的"诊断面板”

运行时按 ~ 输入:

命令 作用
ability.showdebug ability 当前 ASC 的属性、GE、Tag 一览
ability.showdebug targeting 目标数据调试
ability.showdebug interaction 交互(Lyra 引入)
log GameplaySystem Verbose 详细日志

多按几次 ability.showdebug 会切换"页签"(Attributes / Effects / Tags)。这个面板是排查"GAS 为什么没生效"的第一工具,比任何打印都全面。

本章小结

  • 三插件依赖(GameplayAbilities/Tags/Tasks)写进 Build.cs 即可。
  • 全局设置集中在 AbilitySystemGlobals,一般项目保持默认。
  • 养成用 ability.showdebug 诊断问题的习惯,它是 GAS 的"第二双眼睛"。