第二步:配置-PC Steam端
- 集成SDK后可以支持Steam登录、支付等功能;
TIP
1、需要提前在steam后台 (opens new window)创建应用
2、测试登录需要将测试账号添加到steam后台账户中,具体参考官方文档 (opens new window)
3、只支持Standalong、Development和Debug模式; Shipping模式需要在steam发布后才生效
4、Editor模式UE引擎不支持IOnlineSubsystem,故不支持此模式下调试
# 1 添加Steam系统插件
1、在UE4编辑器中Settings
-Plugins
中勾选Online Subsystem
、Online Subsystem Steam
,如图:
- 勾选后重启UE4编辑器
2、插件项目中Engine
-Source
-ThirdParty
-Steamworks
是否包含对应版本SDK文件,如果没有对应SDK文件,则需要下载SteamSDK (opens new window),并解压后将SDK文件夹拷贝到上述目录中,并修改对应版本信息。
如开发环境:/UE4/UE_4.27/Engine/Source/ThirdParty/Steamworks/Steamv147
- 确保文件目录版本与
Steamworks.build.cs
中的版本一致
# 2 DefaultEngine.ini添加设置
1、修改UE4项目工程中Config
-DefaultEngine.ini
文件,并添加如下Steam相关配置
[/Script/Engine.GameEngine]
+NetDriverDefinitions=(DefName="GameNetDriver",DriverClassName="OnlineSubsystemSteam.SteamNetDriver",DriverClassNameFallback="OnlineSubsystemUtils.IpNetDriver")
[OnlineSubsystem]
DefaultPlatformService=Steam
[OnlineSubsystemSteam]
bEnabled=true
SteamDevAppId=2307240
bInitServerOnClient=true
[/Script/OnlineSubsystemSteam.SteamNetDriver]
NetConnectionClassName="OnlineSubsystemSteam.SteamNetConnection"
[PacketHandlerComponents]
+Components=OnlineSubsystemSteam.SteamAuthComponentModuleInterface
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
- 其中2307240需要游戏修改为真实申请参数,2307240为官方测试ID,应用id在steam后台 (opens new window)应用详情页面可以看到,如下图官网测试应用:
# 3 在USDK插件中启用Steam支持
修改 Plugins/HeroUSDKPlugin/Source/HeroUSDKPlugin/HeroUSDKPlugin.Build.cs 文件,添加宏:
#define USE_STEAM
1
如下图:
# 4 渠道初始化设置修改
1、游戏游戏开发者在HeroUsdkSupportKit->init
方法内部添加isSteamChannel
配置.
struct FHeroGameChannelProject gameChannelProject;
//环境参数【请联系成都运营】
gameChannelProject.productId = "D10309A";
gameChannelProject.projectId = "P34345A";
gameChannelProject.serverId = "M1257A";
gameChannelProject.appKey = "VlZdSWMHVjgaxgVfaGl9";
gameChannelProject.appSecret = "YFS3LsBe8sf3UvDiaYqd";
gameChannelProject.gameName = TEXT("PC测试游戏");
gameChannelProject.pkg = "com.hero.pc.sdk";
//支持Steam登录、支付需要开启
gameChannelProject.isSteamChannel = true ;
gameChannelProject.cid = "247";
uProject.gameChannelProject = gameChannelProject;
//PC初始化
HeroUsdkSupportPcDelegate::GetInstance()->Init(uProject);
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
本文档对解决你的问题有所帮助?
文档反馈