GAS问题解决,AttribteSet 方法 PostGamePlayEffectExcute 中data无法调用属性

张开发
2026/4/7 22:55:14 15 分钟阅读

分享文章

GAS问题解决,AttribteSet 方法 PostGamePlayEffectExcute 中data无法调用属性
1. 代码voidUFightAttributeSet::PostGameplayEffectExecute(constFGameplayEffectModCallbackDataData){Super::PostGameplayEffectExecute(Data);// 无法调用 Data.EffectSpc}2.解决头文件导入#includeGameplayEffectExtension.h该头文件中含有构造体如下structFGameplayEffectModCallbackData{FGameplayEffectModCallbackData(constFGameplayEffectSpecInEffectSpec,FGameplayModifierEvaluatedDataInEvaluatedData,UAbilitySystemComponentInTarget):EffectSpec(InEffectSpec),EvaluatedData(InEvaluatedData),Target(InTarget){}conststructFGameplayEffectSpecEffectSpec;// The spec that the mod came fromstructFGameplayModifierEvaluatedDataEvaluatedData;// The flat/computed data to be applied to the targetclassUAbilitySystemComponentTarget;// Target we intend to apply to};3.哈哈开个玩笑 。。。 其实很多方法不要用.来直接点而是使用 - 一个减号 和 一个大于号来调用方法编辑器会自动帮你导入头文件。例如上述Data.EffectSpc 可以Data-4.这涉及到编译前向声明之类的比如我在UMG中的 .h文件 中classUImage;TObjectUImageIcon_Image使用前向声明的方式获取引用。而在C文件中如果我想调用Icon_Image.SetBrush();是无法调用的。此时你就得手动导入才行。#include“Components/UImage.h”你使用Rider之类的编辑器你可以直接Icon_Image-此时就能弹出他的成员函数之类的你回车或者打全他会自动帮你补齐头文件。

更多文章