内容纲要
一、方法
第一步:
创建一个UAbilitySystemGlobals的派生类

第二步:
修改Config/DefaultGame.ini配置,添加以下配置:
[/Script/GameplayAbilities.AbilitySystemGlobals]
+AbilitySystemGlobalsClassName="/Script/YourModuleName.YourAbilitySystemGlobals"
其中,YourModuleName是模块名,YourAbilitySystemGlobals是类名(不包含开头的U字母)
第三步:
重启引擎,在GameplayAbilitiesModule.cpp的GetAbilitySystemGlobals函数中,应该要能够跟踪到它使用了新的类
二、好处:
This class is very crucial for any game utilising the Gameplay Ability System (GAS). I recommend every serious game make their own subclass of this. This class is responsible for setting up the core GAS stuff, below i provide a couple of reasons why you would and should create your own.
- Allows you initialise global tags which can be used in native code.
- Allows you to change what stuff get gets initialised into GameplayCue Parameters.
- Allows you to change what class you want to use for AttributeSet Initter.
- Allows you to change what class your EffectContext uses.
- Allows you to change what class your AbilityActorInfo uses.
There are also many more reasons, but these are the most common ones. With that in mind, let us go creating and setting up our own custom UAbilitySystemGlobals for our project.