2015-10-27 29 views
1

是否可以在5以下的团结版本中使用谷歌玩游戏任务?我使用Unity 4.5.2f1,并使用最新的Google Play游戏插件。当我添加此代码来显示任务:在Unity中使用Google Play Quest 4

PlayGamesPlatform.Instance.Quests.ShowAllQuestsUI(
      (QuestUiResult result, IQuest quest, IQuestMilestone milestone) => { 
      // ... 
    }); 

的scipts引用(QuestUiResult,IQues和IQuesMilestone)不会在当前的背景下存在。

我做错了什么?

任何帮助非常感谢,谢谢。

回答

2

我认为它应该在4.5。我遇到的唯一问题是导入示例unitypackages不太好,但手动添加源工作。

TrivalQuest样品,你应该能够调用是这样的:

using GooglePlayGames; 
using GooglePlayGames.BasicApi; 
using GooglePlayGames.BasicApi.Quests; 

public void ViewQuests() 
    { 
     Debug.Log("clicked:ViewQuests"); 
     PlayGamesPlatform.Instance.Quests.ShowAllQuestsUI(
      (QuestUiResult result, IQuest quest, IQuestMilestone milestone) => 
      { 
       if (result == QuestUiResult.UserRequestsQuestAcceptance) 
       { 
        Debug.Log("User Requests Quest Acceptance"); 
        AcceptQuest(quest); 
       } 

       if (result == QuestUiResult.UserRequestsMilestoneClaiming) 
       { 
        Debug.Log("User Requests Milestone Claim"); 
        ClaimMilestone(milestone); 
       } 
      }); 
    } 
+0

太谢谢你了:)就像一个魅力。我所需要的只是使用GooglePlayGames.BasicApi.Quests。然而,我仍然坚持的一件事是任务的奖励系统。假设我在玩家首选项中拥有一枚硬币值,那么我如何为该任务添加10枚硬币作为完成任务的奖励?,再次感谢@Clayton Wilkinson –

+0

另外,导入最新GPGS插件时发现的问题是在一个的脚本是引用Texture2D.blackTexture,我不认为它存在于Unity 4中,所以我不得不将它改为等于null来修复编译错误。 –

+0

感谢您的意见!任务的奖励由您决定 - 与Play Console上的任务相关联的数据文件包含数据。例如,它可以是json,然后在索赔时读取它。 –