Post

Replies

Boosts

Views

Activity

GameCenter Authentication Code
I'm following the example used in the WWDC video talking about how to get your game to authenticate to the GameCenter servers using the Unity Plugins they have provided. I followed the steps to get the packages imported properly but I am having an issue getting their example got to work. This is the example code: using Apple.GameKit; public class MyGameManager : MonoBehaviour { private GKLocalPlayer _localPlayer; private async Task Start() { try { _localPlayer = await GKLocalPlayer.Authenticate(); } catch (Exception exception) { //Handle exception... } } } My code is: using System.Collections; using System.Collections.Generic; using UnityEngine; using Apple.GameKit; public class GameManager : MonoBehaviour { private GKLocalPlayer _localPlayer; private async Task Start() { try { _localPlayer = await GKLocalPlayer.Authenticate(); } catch { return null; } return null; } } And I get "The type or namespace name 'Task' could not be found (are you missing a using directive or an assembly reference?)" with my code. I haven't delt too much with async and await previously so please let me know if there is something I am missing with this.
1
0
989
Aug ’22