【steam接入】如何将unity游戏接入steam(steamworks)
使用Steamworks.NET,请确保成为steam的开发者(要在steam提交游戏,需要一次性缴纳100美元费用)
sdk地址:http://steamworks.github.io/installation/
c#接口介绍地址:http://steamworks.github.io/gettingstarted/
steamwork使用教程视频:https://www.youtube.com/playlist?list=PLckFgM6dUP2jBeskIPG-7BVJR-I0vcSGJ
Steamwork安装步骤
- 下载 .unitypackage Stable (7.0.0) 或者从 Github 克隆
- 导入下载的所有文件到项目
Assets/
目录下. - 打开unity项目,会自动生成steam_appid.txt到项目的主目录下.
- 打开
steam_appid.txt
并将480
修改为自己的 AppId. - 编辑\Plugins\Steamworks.NET\types\SteamTypes\AppId_t.cs,将public static readonly AppId_t Invalid = new AppId_t(0x0);将0x0修改为自己的app_id
- 重启unity,保证 steam_appid.txt 已生效.
- 安装sdk完成.
如何使用
- 下载SteamManagers.cs
- 将SteamManager.cs脚本挂在GameObject上,steam会自动生成单例
- 完整C#接口请点击查看
注:需要在https://partner.steamgames.com/home下载sdk,里面有提交游戏的工具,在\sdk\tools\ContentBuilder\builder
在https://partner.steamgames.com/home/steamworks可以查看文档
在http://steamworks.github.io/gettingstarted/可以查看C#接口的使用方式
// The SteamManager is designed to work with Steamworks.NET
// This file is released into the public domain.
// Where that dedication is not recognized you are granted a perpetual,
// irrevokable license to copy and modify this files as you see fit.
//
// Version: 1.0.3using UnityEngine;
using System.Collections;
using Steamworks;//
// The SteamManager provides a base implementation of Steamworks.NET on which you can build upon.
// It handles the basics of starting up and shutting down the SteamAPI for use.
//
[DisallowMultipleComponent]
class SteamManager : MonoBehaviour {private static SteamManager s_instance;private static SteamManager Instance {get {return s_instance ?? new GameObject("SteamManager").AddComponent<SteamManager>();}}private static bool s_EverInialized;private bool m_bInitialized;public static bool Initialized {get {return Instance.m_bInitialized;}}private SteamAPIWarningMessageHook_t m_SteamAPIWarningMessageHook;private static void SteamAPIDebugTextHook(int nSeverity, System.Text.StringBuilder pchDebugText) {Debug.LogWarning(pchDebugText);}private void Awake() {// Only one instance of SteamManager at a time!if (s_instance != null) {Destroy(gameObject);return;}s_instance = this;if(s_EverInialized) {// This is almost always an error.// The most common case where this happens is the SteamManager getting desstroyed via Application.Quit() and having some code in some OnDestroy which gets called afterwards, creating a new SteamManager.throw new System.Exception("Tried to Initialize the SteamAPI twice in one session!");}// We want our SteamManager Instance to persist across scenes.DontDestroyOnLoad(gameObject);if (!Packsize.Test()) {Debug.LogError("[Steamworks.NET] Packsize Test returned false, the wrong version of Steamworks.NET is being run in this platform.", this);}if (!DllCheck.Test()) {Debug.LogError("[Steamworks.NET] DllCheck Test returned false, One or more of the Steamworks binaries seems to be the wrong version.", this);}try {// If Steam is not running or the game wasn't started through Steam, SteamAPI_RestartAppIfNecessary starts the // Steam client and also launches this game again if the User owns it. This can act as a rudimentary form of DRM.// Once you get a Steam AppID assigned by Valve, you need to replace AppId_t.Invalid with it and// remove steam_appid.txt from the game depot. eg: "(AppId_t)480" or "new AppId_t(480)".// See the Valve documentation for more information: https://partner.steamgames.com/documentation/drm#FAQif (SteamAPI.RestartAppIfNecessary(AppId_t.Invalid)) {Application.Quit();return;}}catch (System.DllNotFoundException e) { // We catch this exception here, as it will be the first occurence of it.Debug.LogError("[Steamworks.NET] Could not load [lib]steam_api.dll/so/dylib. It's likely not in the correct location. Refer to the README for more details.\n" + e, this);Application.Quit();return;}// Initialize the SteamAPI, if Init() returns false this can happen for many reasons.// Some examples include:// Steam Client is not running.// Launching from outside of steam without a steam_appid.txt file in place.// Running under a different OS User or Access level (for example running "as administrator")// Ensure that you own a license for the AppId on your active Steam account// If your AppId is not completely set up. Either in Release State: Unavailable, or if it's missing default packages.// Valve's documentation for this is located here:// https://partner.steamgames.com/documentation/getting_started// https://partner.steamgames.com/documentation/example // Under: Common Build Problems// https://partner.steamgames.com/documentation/bootstrap_stats // At the very bottom// If you're running into Init issues try running DbgView prior to launching to get the internal output from Steam.// http://technet.microsoft.com/en-us/sysinternals/bb896647.aspxm_bInitialized = SteamAPI.Init();if (!m_bInitialized) {Debug.LogError("[Steamworks.NET] SteamAPI_Init() failed. Refer to Valve's documentation or the comment above this line for more information.", this);return;}s_EverInialized = true;}// This should only ever get called on first load and after an Assembly reload, You should never Disable the Steamworks Manager yourself.private void OnEnable() {if (s_instance == null) {s_instance = this;}if (!m_bInitialized) {return;}if (m_SteamAPIWarningMessageHook == null) {// Set up our callback to recieve warning messages from Steam.// You must launch with "-debug_steamapi" in the launch args to recieve warnings.m_SteamAPIWarningMessageHook = new SteamAPIWarningMessageHook_t(SteamAPIDebugTextHook);SteamClient.SetWarningMessageHook(m_SteamAPIWarningMessageHook);}}// OnApplicationQuit gets called too early to shutdown the SteamAPI.// Because the SteamManager should be persistent and never disabled or destroyed we can shutdown the SteamAPI here.// Thus it is not recommended to perform any Steamworks work in other OnDestroy functions as the order of execution can not be garenteed upon Shutdown. Prefer OnDisable().private void OnDestroy() {if (s_instance != this) {return;}s_instance = null;if (!m_bInitialized) {return;}SteamAPI.Shutdown();}private void Update() {if (!m_bInitialized) {return;}// Run Steam client callbacksSteamAPI.RunCallbacks();}
}
接入问题:
*使用默认的appid 480可以获取到接口,替换为自己的appid报错steam api初始化失败?
应该是steam帐号里面没有该appid的游戏权限。
*Failed to load 'Assets/Plugins/x86_64/CSteamworks.dll' with error '找不到指定的模块。
还没找到解决办法
*下载报错 Steam安装失败(程序配置文件不可用)或 Failed to start game (invalid app config)
如果测试帐号可以下载安装,而黄色或者红色key不可安装,则是因为应用商店页面清单未完成并提交Valve审核,审核通过才可。具体可以参见steam开发者讨论区 https://steamcommunity.com/groups/steamworks/discussions/0/523897023725510452/
*如何只允许在Steam的某些地区销售?
需要联系Steam客服,说明限制地区和理由 https://partner.steamgames.com/home/contact
*如何测试应用?
在后台申请红色激活码,使用steam通过激活码进行下载测试。
红色激活码(只能内部使用)、黄色激活码(外部使用)、透明激活码(发布后使用)
*.ico和icns文件如何制作?
使用ico制作软件如IcoFX制作多个尺寸的ico文件,在线做只能输出一个尺寸。需要尺寸16 32 48 64 128 256越多越好。
*Mac发布后,steam安装显示0bytes。
相关程序包与 DLC商店程序包、促销或特殊用途程序包中添加所有depot即可。
*发布mac后打开闪退
发布steam应用mac版本时,确保playersetting下的Mac AppStore Validation取消掉,不然steam版本打开会闪退
【steam接入】如何将unity游戏接入steam(steamworks)相关推荐
- Unity游戏接入TypeSDK集成笔记
前言: 这是一个unity小程序猿使用typesdk给公司项目接入各渠道游戏联运sdk的使用笔记,说是笔记是因为从接触这个聚合工具到接入项目中并且将项目上线到渠道(目前已上线oppo,huawei,a ...
- 最近想给自己的Unity游戏接入广告
最近想给自己的游戏接入广告,就记录下了一篇很优秀的博客 需要的朋友可以看看 https://blog.csdn.net/qq_36622009/article/details/104818876
- (转)申请企业级IDP、真机调试、游戏接入GameCenter 指南、游戏接入OpenFeint指南;...
Himi 原创, 转载请注明出处,谢谢! 原文地址:http://blog.csdn.net/xiaominghimi/article/details/6913967 这里Himi给出对于开发iOS的 ...
- Unity游戏接入百度移动广告
本篇文章我们讲解利用百度 Unity Plugin这个插件,这个插件使用很简单 1. 新开一个Unity工程,导入百度 Unity Plugin这个插件包 2.导入后将baidudemo.cs这个类文 ...
- 【Steam】关于上传游戏至Steam,Depot产生的问题
假设我的Steam appID 为 1000: 我的第一个Depot 为 1001: 第二个Depot 为 1002: 在默认状态下,我用SteamPipeGUI,上传至1001是没什么问题的. 但是 ...
- Unity如何接入应用内购In-AppPurchase
一.前言 很多游戏需要接入内购IAP,对于苹果端,我们直接对接苹果就行了,但是android平台太多,国内,我们需要接入支付宝,微信,或者华为支付,小米支付等.国外,我们需要接入谷歌支付,亚马逊等等, ...
- rust和gta5哪个吃配置_盘点4款Steam“自由度”很高的游戏,GTA5众所周知,目前最热门...
原标题:盘点4款Steam"自由度"很高的游戏,GTA5众所周知,目前最热门 大家好今天小编给大家带来的是"盘点4款Steam"自由度"很高的游戏,G ...
- Unity如何接入本地推送 Mobile Notifications
一. 前言 当一款游戏发展到一定阶段,必不可少的要接入推送SDK,推送功能,分为以下两种: 本地推送:玩家打开游戏后,给手机系统通知设置推送的倒计时,等游戏关闭后,倒计时结束时,手机会自动打开通知给用 ...
- steam linux游戏_1600个适用于Linux on Steam的游戏,Linux友好的Steam促销以及更多开放式游戏新闻
steam linux游戏 您好,开放游戏迷! 在本周的版本中,我们将介绍1600个适用于Steam上的Linux的游戏,一个适用于Linux的Steam促销以及一个得分较高的Arduino项目等. ...
最新文章
- 在python程序中的进程操作
- 【git学习四】git基础之git为项目打标签
- python教程:__file__、__name__、__dict__三个方法的作用
- 阿里巴巴大规模应用Flink的踩坑经验:如何大幅降低 HDFS 压力?
- RMAN删除归档日志不释放问题
- 08 redis数据类型:hash
- Hbase总结(四)- Hbase与传统数据库的区别
- (一)Git学习记录(不断更新)
- Bootstrap分页
- php如何减缓gc_管理信息传播-使用数据科学减缓错误信息的传播
- ARM不同位数系统int字节数区别
- mpython 直接访问_如何从python代码中直接访问Android的Service
- iperf测试带宽linux,iperf3-网络带宽性能测试工具
- php undefined empty,怎样处理php undefined index毛病问题_后端开发
- 关于HTML5中meta name=“viewport“ 的用法---web前端工作笔记014
- Win10之选择文件右击时卡死问题(转圈圈)
- 让IE6支持min-width和max-width的方法
- windows下文件路径太深,删除解决方案
- 升级!鹏业云计价i20(西藏)软件V11.0.27版本
- android中读取svg文件,Android如何加载SVG格式的矢量图