当前位置:网站首页>UE5 GAS 学习笔记0.2配置插件
UE5 GAS 学习笔记0.2配置插件
2022-07-28 17:05:00 【CloudHu1989】
前言
这一节讲如何在项目中配置GAS插件。
一、插件配置
在项目中使用GAS的基本步骤:
- 在编辑器中启用GameplayAbilitySystem插件.


- 编辑
YourProjectName.Build.cs, 添加"GameplayAbilities","GameplayTags","GameplayTasks"到你的PrivateDependencyModuleNames.
打开YourProjectName.Build.cs
using UnrealBuildTool;
public class GASDocumentation : ModuleRules
{
public YourProjectName(ReadOnlyTargetRules Target) : base(Target)
{
PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
PublicDependencyModuleNames.AddRange(new string[] {
"Core", "CoreUObject", "Engine", "InputCore", "HeadMountedDisplay" });
PrivateDependencyModuleNames.AddRange(new string[] {
"Slate",
"SlateCore",
"GameplayAbilities",
"GameplayTags",
"GameplayTasks"
});
}
}
- 在项目文件夹下找到
YourProjectName.uproject,鼠标右键点击Generate Visual Studio project files刷新/重新生成Visual Studio项目文件. - 从4.24开始, 需要强制调用
UAbilitySystemGlobals::InitGlobalData()来使用[TargetData], 样例项目在UEngineSubsystem::Initialize()中调用该函数. 参阅[InitGlobalData()]获取更多信息.
在UE5中改在UGDAssetManager中的UGDAssetManager::StartInitialLoading调用,详细实现如下:
UGDAssetManager.h:
#pragma once
#include "CoreMinimal.h"
#include "Engine/AssetManager.h"
#include "GDAssetManager.generated.h"
/** * 资源管理 */
UCLASS()
class GASDOCUMENTATION_API UGDAssetManager : public UAssetManager
{
GENERATED_BODY()
public:
//单例模式声明
static UGDAssetManager& Get();
/** Starts initial load, gets called from InitializeObjectReferences */
virtual void StartInitialLoading() override;
};
UGDAssetManager.cpp:
#include "GDAssetManager.h"
#include "AbilitySystemGlobals.h"
//单例模式定义
UGDAssetManager& UGDAssetManager::Get()
{
UGDAssetManager* Singleton = Cast<UGDAssetManager>(GEngine->AssetManager);
if (Singleton)
{
return *Singleton;
}
else
{
UE_LOG(LogTemp, Fatal, TEXT("Invalid AssetManager in DefaultEngine.ini, must be GDAssetManager!"));
return *NewObject<UGDAssetManager>(); // never calls this
}
}
void UGDAssetManager::StartInitialLoading()
{
Super::StartInitialLoading();
UAbilitySystemGlobals::Get().InitGlobalData();
}
这里重写了UAssetManager的StartInitialLoading,在资源开始初始加载时会初始化GAS的全局数据,详细实现参考Unreal Engine 5源码。
这就是你启用GAS所需做的全部了. 从这里开始, 添加一个[ASC]和[AttributeSet]到你的Character或PlayerState, 并开始着手[GameplayAbility]和[GameplayEffect]!
UE5 GAS 学习笔记目录
前置技能:1.编程语言C++;2.Unreal Engine 5;3.Github和VS开发环境
1.0 概念
1.1 能力系统组件(AbilitySystemComponent)
1.2 游戏标签(GameplayTag)
1.3 属性(Attribute)
1.4 属性集(AttributeSet)
1.5 游戏效果(GameplayEffect)
1.6 技能(GameplayAbility)
1.7 任务(AbilityTask)
1.8 特效(GameplayCue)
1.9 技能系统全局(AbilitySystemGlobals)
1.10 预测(Prediction)
1.11 目标定位(Targeting)
2.0 常用技能和效果
2.1 眩晕
2.2 冲刺
2.3 瞄准
2.4 生命偷取
2.5 在客户端和服务器生成一个随机数
2.6 暴击
2.7 受击
2.8 当游戏暂停时生成目标数据
2.9 一键互动系统
3.0 调试
3.1 显示调试信息
3.2 游戏调试器
3.3 日志
4.0 优化
4.1 技能批处理
4.2 特效批处理
4.3 技能系统组件网络同步模式
4.4 属性代理网络同步协议
4.5 技能系统组件懒加载
5.0 建议
5.1 效果容器
5.2 技能系统组件代理绑定
6.0 疑难
6.1LogAbilitySystem: Warning: Can't activate LocalOnly or LocalPredicted ability %s when not local!
6.2 脚本结构体缓存错误
6.3 动画蒙太奇没有同步到客户端
6.4 复制的蓝图角色把属性集设置为空指针
6.5 无法解析的外部符号:UEPushModelPrivate::MarkPropertyDirty(int,int)
8.0 参考资料
8.1 虚幻引擎官方文档
8.2 Github开源项目
- 4.27
- 4.26
- 4.25.1
- 4.25
- 4.24
10. 0案例分析
10.1 GASDocumentation案例(上)
10.1 GASDocumentation案例(中)
10.1 GASDocumentation案例(下)
10.2 GASShooter案例解析
10.3 LyraStarter案例解析
边栏推荐
- WordPress prompt error in establishing database connection
- 微信公众号授权登录后报redirect_uri参数错误的问题
- Go语言系列之日志库zap
- Go的walk库报错
- Digital torrent: resource reorganization and strategic conflict in enterprise transformation
- MySQL operation Encyclopedia
- Tencent Tang Daosheng: open source is a new mode of production and collaboration in the era of industrial Internet
- 2023年网络安全预算规划的五个关键考虑因素
- Tcp/ip detailed diagram
- cout.write的学习
猜你喜欢

腾讯汤道生:开源是产业互联网时代新的生产方式和协作模式

ADS仿真 之 交流仿真和S参数仿真示例

USB Type-C 详解

Tencent Tang Daosheng: open source is a new mode of production and collaboration in the era of industrial Internet

频谱仪原理简介一

微信公众号授权登录后报redirect_uri参数错误的问题

Introduction to CC cable of USB type-C

顿悟!百度强推的Redis天花板笔记,原来数据库是这样理解的

Food safety | will the salt content of bread exceed the standard? A few tips to teach you to eat bread correctly!

矢量网络分析仪(矢网)组成和原理简介
随机推荐
Go并发详解之一
Docker搭建Mysql主从复制
UE5 GAS 学习笔记 1.5 Gameplay Effects游戏效果
ADS仿真 之 直流仿真示例
There is a special cryptology language called asn.1
UE5 GAS 学习笔记 1.9 技能系统全局类(AbilitySystemGlobals)
"Cloud strategy" will become an important pillar of enterprise digital transformation
Examples of AC simulation and S-parameter simulation of ADS simulation
实验楼----PHP大法
有一种密码学专用语言叫做ASN.1
Live broadcast starrocks technology insider: low base global dictionary optimization
[untitled]
DC simulation example of ADS simulation
Food safety | will the salt content of bread exceed the standard? A few tips to teach you to eat bread correctly!
GO exe生成图标版本信息
高德地图实现自定义小蓝点 自定义点标记 绘制多边形/圆形区域 根据地图的移动显示或者隐藏自定义点标记的相关实现
Huawei ZTE lost the lawsuit in the UK and will be banned if it does not pay the patent licensing fee!
.net WCF WF4.5 状态机、书签与持久化
ADS仿真 之 交流仿真和S参数仿真示例
UE5 GAS 学习笔记 1.8 游戏特效(GameplayCue)