当前位置:网站首页>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案例解析
边栏推荐
- Syntax error: non declaration statement outside function bodygo and syntax error: unexpected {, expect
- 顿悟!百度强推的Redis天花板笔记,原来数据库是这样理解的
- Import the database backup of MySQL 8 into MySQL 5
- Application of Internet of things in smart city
- solidity的require报错
- 天线的原理、分类及要求
- Docker搭建Mysql主从复制
- Noise of creative coding
- iptables 配置
- Novice record: some small knowledge of mechanical keyboard
猜你喜欢

天线的主要参数介绍

食品安全 | 面包含盐量也会超标?几招教你正确吃面包!

Introduction to CC cable of USB type-C

示波器参数详解

Mqtt over quic: the next generation Internet of things standard protocol injects new impetus into the message transmission scenario

USB Type-C 之CC线简介

Experimental building - PHP Dafa

矢量网络分析仪(矢网)的校准

Advanced Design System(ADS)2009 射频仿真入门

Centos8 creates wordpress+mysql error reports according to the official website of docker
随机推荐
.net swagger
Introduction to main parameters of antenna
MQTT over QUIC:下一代物联网标准协议为消息传输场景注入新动力
Noise of creative coding
MySQL operation Encyclopedia
solidity的modifier修饰器的_;
.net WCF wf4.5 state machine, bookmark and persistence
Import the database backup of MySQL 8 into MySQL 5
Brief introduction to the principle of spectrometer II
Look at Devops construction from SRE
【译】创意编码之噪音
USB Type-C 详解
Go的sleep
The revenue of Shanghai silicon industry in the first half of the year was 850million yuan, an increase of 30.53% year on year! Various product certifications are accelerating
食品安全 | 面包含盐量也会超标?几招教你正确吃面包!
Trial record of ModelBox end cloud collaborative AI development kit (rk3568) (III)
USB Type-C PD快充简介
solidity的require报错
网络RJ45接口详解
矢量网络分析仪(矢网)组成和原理简介