你看过this,它很好理解。
更新的代码片段:
至Init,谷歌播放:
using GooglePlayGames;
using GooglePlayGames.BasicApi;
using UnityEngine.SocialPlatforms;
PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder()
// enables saving game progress.
.EnableSavedGames()
.Build();
PlayGamesPlatform.InitializeInstance(config);
// recommended for debugging:
PlayGamesPlatform.DebugLogEnabled = true;
// Activate the Google Play Games platform
PlayGamesPlatform.Activate();
要登录(在开始(这个),您已经激活了平台后):
Social.localUser.Authenticate((bool success) => {
// handle success or failure
});
从这里开始,请阅读详细说明如何读取和写入保存游戏到云中的文档。该部分可以找到here。阅读代码并根据您的具体使用情况进行调整。我不能为你写。
我已经通过文档,但我不想显示加载游戏画面。我想要的是以下工作流程: - 1.用户开始游戏。 2.自动谷歌玩游戏登录。3.自动加载用户拥有的硬币数量和他的高分。 4.在游戏结束后,自动保存硬币数量和高分。 – Saurabh
@Saurabh我编辑了我的答案,以帮助您更好地理解。您需要的所有代码都在文档中。 –