お好みのスクリプト言語を選択すると、サンプルコードがその言語で表示されます。
Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.
Close現在のアクティブな Social API 実装に対してローカルユーザを認証しそのプロファイルデータをフェッチします
これは他の API コールを行なう前に行なわれるべきです。プラットフォームによって、これはログインの詳細を表示するブロックのダイアログをトリガーする場合があります。
// JavaScript Social.localUser.Authenticate (function (success) { if (success) { Debug.Log ("Authentication successful"); var userInfo : String = "Username: " + Social.localUser.userName + "\nUser ID: " + Social.localUser.id + "\nIsUnderage: " + Social.localUser.underage; Debug.Log (userInfo); } else Debug.Log ("Authentication failed"); });
// C# Social.localUser.Authenticate (success => { if (success) { Debug.Log ("Authentication successful"); string userInfo = "Username: " + Social.localUser.userName + "\nUser ID: " + Social.localUser.id + "\nIsUnderage: " + Social.localUser.underage; Debug.Log (userInfo); } else Debug.Log ("Authentication failed"); });