如何将unity游戏unity接入微信sdksteam

1066人阅读
unity3d(57)
Android(9)
unity不知道是什么版本开始提供了一个自动合并AndroidManifest.xml的功能,这样接入多个sdk就变的特别容易,这也是在接入unityads的时候发现的一个小技巧。
◇在Android目录下没有AndroidManifest.xml文件,unity会自动合并所有子目录下的AndroidManifest.xml。
◇在Android目录下有AndroidManifest.xml文件,unity会合并其他目录内的文件包括AndroidManifest.xml到该AndroidManifest.xml下。
参考知识库
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
访问:75956次
积分:1437
积分:1437
排名:千里之外
原创:62篇
转载:10篇
评论:62条
(1)(1)(1)(1)(4)(2)(2)(6)(4)(7)(6)(5)(2)(2)(2)(1)(5)(4)(2)(1)(3)(5)(2)(6)【steam接入】如何将unity游戏接入steam(steamworks)
我的图书馆
【steam接入】如何将unity游戏接入steam(steamworks)
&使用Steamworks,请确保成为steam的开发者(要在steam提交游戏,需要一次性缴纳100美元费用)
sdk地址:http://steamworks.github.io/installation/
c#接口介绍地址:http://steamworks.github.io/gettingstarted/
Steamwork安装步骤
下载 .unitypackage&&或者从&&克隆导入下载的所有文件到项目&Assets/&目录下.打开unity项目,会自动生成steam_appid.txt到项目的主目录下.打开&steam_appid.txt&并将&480&修改为自己的&AppId.重启unity,保证 steam_appid.txt 已生效.安装sdk完成.
下载将SteamManager.cs脚本挂在GameObject上,steam会自动生成单例完整C#接口请点击
注:需要在/home下载sdk,里面有提交游戏的工具,在\sdk\tools\ContentBuilder\builder
& & & & 在/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.3&&&&using&UnityE&&using&System.C&&using&S&&&&//&&//&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_&&&&&&private&static&SteamManager&Instance&{&&&&&&&&&&get&{&&&&&&&&&&&&&&return&s_instance&??&new&GameObject("SteamManager").AddComponent&SteamManager&();&&&&&&&&&&}&&&&&&}&&&&&&&&private&static&bool&s_EverI&&&&&&&&private&bool&m_bI&&&&&&public&static&bool&Initialized&{&&&&&&&&&&get&{&&&&&&&&&&&&&&return&Instance.m_bI&&&&&&&&&&}&&&&&&}&&&&&&&&private&SteamAPIWarningMessageHook_t&m_SteamAPIWarningMessageH&&&&&&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);&&&&&&&&&&&&&&&&&&&&&&&&}&&&&&&&&&&s_instance&=&&&&&&&&&&&&&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:&/documentation/drm#FAQ&&&&&&&&&&&&&&if&(SteamAPI.RestartAppIfNecessary(AppId_t.Invalid))&{&&&&&&&&&&&&&&&&&&Application.Quit();&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&}&&&&&&&&&&}&&&&&&&&&&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();&&&&&&&&&&&&&&&&&&&&&&&&}&&&&&&&&&&&&//&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:&&&&&&&&&&//&/documentation/getting_started&&&&&&&&&&//&/documentation/example&//&Under:&Common&Build&Problems&&&&&&&&&&//&/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.&&&&&&&&&&//&/en-us/sysinternals/bb896647.aspx&&&&&&&&&&m_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);&&&&&&&&&&&&&&&&&&&&&&&&&&}&&&&&&&&&&&&s_EverInialized&=&&&&&&&}&&&&&&&&//&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&=&&&&&&&&&&&}&&&&&&&&&&&&if&(!m_bInitialized)&{&&&&&&&&&&&&&&&&&&&&&&&&}&&&&&&&&&&&&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)&{&&&&&&&&&&&&&&&&&&&&&&&&}&&&&&&&&&&&&s_instance&=&&&&&&&&&&&&&if&(!m_bInitialized)&{&&&&&&&&&&&&&&&&&&&&&&&&}&&&&&&&&&&&&SteamAPI.Shutdown();&&&&&&}&&&&&&&&private&void&Update()&{&&&&&&&&&&if&(!m_bInitialized)&{&&&&&&&&&&&&&&&&&&&&&&&&}&&&&&&&&&&&&//&Run&Steam&client&callbacks&&&&&&&&&&SteamAPI.RunCallbacks();&&&&&&}&&}&&
TA的最新馆藏

我要回帖

更多关于 unity 支付宝sdk接入 的文章

 

随机推荐