質問編集履歴
1
追記
title
CHANGED
File without changes
|
body
CHANGED
@@ -167,4 +167,46 @@
|
|
167
167
|
|
168
168
|
### 補足情報(FW/ツールのバージョンなど)
|
169
169
|
|
170
|
-
Unity 2020.1.2f1 (64-bit)
|
170
|
+
Unity 2020.1.2f1 (64-bit)
|
171
|
+
|
172
|
+
### 追記
|
173
|
+
|
174
|
+
Startメソッドを下記のように書き換えました。
|
175
|
+
```
|
176
|
+
void Start()
|
177
|
+
{
|
178
|
+
Firebase.FirebaseApp.CheckAndFixDependenciesAsync().ContinueWith(task => {
|
179
|
+
var dependencyStatus = task.Result;
|
180
|
+
if (dependencyStatus == Firebase.DependencyStatus.Available) {
|
181
|
+
// Create and hold a reference to your FirebaseApp,
|
182
|
+
// where app is a Firebase.FirebaseApp property of your application class.
|
183
|
+
// app = Firebase.FirebaseApp.DefaultInstance;
|
184
|
+
|
185
|
+
// Set a flag here to indicate whether Firebase is ready to use by your app.
|
186
|
+
} else {
|
187
|
+
UnityEngine.Debug.LogError(System.String.Format(
|
188
|
+
"Could not resolve all Firebase dependencies: {0}", dependencyStatus));
|
189
|
+
// Firebase Unity SDK is not safe to use here.
|
190
|
+
}
|
191
|
+
});
|
192
|
+
|
193
|
+
InitializeFirebase();
|
194
|
+
|
195
|
+
Firebase.Auth.Credential credential =
|
196
|
+
Firebase.Auth.GoogleAuthProvider.GetCredential(googleIdToken, googleAccessToken);
|
197
|
+
auth.SignInWithCredentialAsync(credential).ContinueWith(task => {
|
198
|
+
if (task.IsCanceled) {
|
199
|
+
Debug.LogError("SignInWithCredentialAsync was canceled.");
|
200
|
+
return;
|
201
|
+
}
|
202
|
+
if (task.IsFaulted) {
|
203
|
+
Debug.LogError("SignInWithCredentialAsync encountered an error: " + task.Exception);
|
204
|
+
return;
|
205
|
+
}
|
206
|
+
|
207
|
+
Firebase.Auth.FirebaseUser newUser = task.Result;
|
208
|
+
Debug.LogFormat("User signed in successfully: {0} ({1})",
|
209
|
+
newUser.DisplayName, newUser.UserId);
|
210
|
+
});
|
211
|
+
}
|
212
|
+
```
|