Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- public class GameJoltAPIManager : MonoBehaviour
- {
- // On GameJolt, go to 'Dashboard', click the game you're adding this to, and go to 'Achievements'
- // There will be a window called 'Game Info' that has this info
- public int gameID;
- public string privateKey;
- public string userName;
- public string userToken;
- void Awake()
- {
- // Make sure the game object stays even if the player goes to a different scene
- DontDestroyOnLoad(gameObject);
- // Initialize the API
- GJAPI.Init(gameID, privateKey);
- // Show the Login window
- GJAPIHelper.Users.ShowLogin();
- // Make sure the person is actually a person
- GJAPI.Users.Verify(userName, userToken);
- }
- void OnEnable()
- {
- GJAPI.Users.VerifyCallback += OnVerifyUser;
- }
- void OnDisable()
- {
- GJAPI.Users.VerifyCallback -= OnVerifyUser;
- }
- void OnVerifyUser(bool success)
- {
- if (success)
- {
- Debug.Log("Works");
- }
- else
- {
- Debug.Log("Failed");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment