以下为归类总结,不当之处尽可指出~~ ^ _ ^
UE4 官方文档:
https://docs.unrealengine.com/5.1/zh-CN/online-subsystem-steam-interface-in-unreal-engine/
文档小结:
1,下载steamSDK,解压后将sdk文件夹拷贝到引擎文件夹下,并修改对应版本信息
如:/UnrealEnginez/Engine/Source/ThirdParty/Steamworks/Steamv153/
如果更新SteamWork[当前版本],还需要更新项目目录中的
Steamworks.build.cs
。// The current SDK version number. double SteamVersionNumber = 1.53;
2,DefaultEngine.ini添加设置
[/Script/Engine.GameEngine]
+NetDriverDefinitions=(DefName="GameNetDriver",DriverClassName="OnlineSubsystemSteam.SteamNetDriver",DriverClassNameFallback="OnlineSubsystemUtils.IpNetDriver")
//根据[在线子系统](https://docs.unrealengine.com/5.1/zh-CN/online-subsystem-in-unreal-engine/),
//基本模块 `OnlineSubsystem` 在引擎中注册。在初始化期间,在线子系统将尝试加载"Engine.ini"文件中指定的默认在线服务模块。对在线服务的所有访问都将通过此模块。
[OnlineSubsystem]
DefaultPlatformService=Steam
[OnlineSubsystemSteam]
bEnabled=true
SteamDevAppId=480
[/Script/OnlineSubsystemSteam.SteamNetDriver]
NetConnectionClassName="OnlineSubsystemSteam.SteamNetConnection"
获取在线子系统
static IOnlineSubsystem* Get(const FName& SubsystemName = NAME_None)
启用SteamAuth——在线身份验证(非必须)
[PacketHandlerComponents]
+Components=OnlineSubsystemSteam.SteamAuthComponentModuleInterface
3,模块设置
在[game].build.cs里添加以下行
DynamicallyLoadedModuleNames.Add("OnlineSubsystemSteam");
总结:
1,开启Steam插件并重启
2,修改配置文件 DefaultEngine.ini
3,登录你的Steam(要确保你的Steam已经登录)
4,独立模式运行,能看到右下角弹出steam提示。(4.24测试有效;4.26需要用LaunchGame运行才能看到)
OK了!
参考:
1,https://www.jianshu.com/p/47ae10cc0a4b
2,https://docs.unrealengine.com/en-us/Programming/Online/Steam
3,https://www.unrealengine.com/zh-CN/blog/steam-support-in-unreal-engine-4