Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Twitter Kit for UnityのSample
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using TwitterKit.Unity;
public class TwitterKitForUnitySample : MonoBehaviour {
private string _AccessToken;
private string _Secret;
void Start () {
Twitter.Init();
this.TwitterAuth();
}
void Update () {}
public void TwitterAuth() {
Debug.Log("[Info] : start login");
TwitterSession session = Twitter.Session;
if (session == null) {
Twitter.LogIn(LoginComplete, LoginFailure);
} else {
LoginComplete(session);
}
}
public void LoginComplete(TwitterSession session) {
Debug.Log("[Info] : Login success. " + session.authToken);
_AccessToken = session.authToken.token;
_Secret = session.authToken.secret;
}
public void LoginFailure(ApiError error) {
Debug.Log("[Error ] : Login faild code =" + error.code + " msg =" + error.message);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.