Last active
August 26, 2017 19:02
-
-
Save yuw-unknown/7ba0f353ccdd0406d2fd699a239ab5f0 to your computer and use it in GitHub Desktop.
Twitter Kit for UnityのSample
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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