質問編集履歴

1

追記

2020/08/29 14:32

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -337,3 +337,87 @@
337
337
 
338
338
 
339
339
  Unity 2020.1.2f1 (64-bit)
340
+
341
+
342
+
343
+ ### 追記
344
+
345
+
346
+
347
+ Startメソッドを下記のように書き換えました。
348
+
349
+ ```
350
+
351
+ void Start()
352
+
353
+ {
354
+
355
+ Firebase.FirebaseApp.CheckAndFixDependenciesAsync().ContinueWith(task => {
356
+
357
+ var dependencyStatus = task.Result;
358
+
359
+ if (dependencyStatus == Firebase.DependencyStatus.Available) {
360
+
361
+ // Create and hold a reference to your FirebaseApp,
362
+
363
+ // where app is a Firebase.FirebaseApp property of your application class.
364
+
365
+ // app = Firebase.FirebaseApp.DefaultInstance;
366
+
367
+
368
+
369
+ // Set a flag here to indicate whether Firebase is ready to use by your app.
370
+
371
+ } else {
372
+
373
+ UnityEngine.Debug.LogError(System.String.Format(
374
+
375
+ "Could not resolve all Firebase dependencies: {0}", dependencyStatus));
376
+
377
+ // Firebase Unity SDK is not safe to use here.
378
+
379
+ }
380
+
381
+ });
382
+
383
+
384
+
385
+ InitializeFirebase();
386
+
387
+
388
+
389
+ Firebase.Auth.Credential credential =
390
+
391
+ Firebase.Auth.GoogleAuthProvider.GetCredential(googleIdToken, googleAccessToken);
392
+
393
+ auth.SignInWithCredentialAsync(credential).ContinueWith(task => {
394
+
395
+ if (task.IsCanceled) {
396
+
397
+ Debug.LogError("SignInWithCredentialAsync was canceled.");
398
+
399
+ return;
400
+
401
+ }
402
+
403
+ if (task.IsFaulted) {
404
+
405
+ Debug.LogError("SignInWithCredentialAsync encountered an error: " + task.Exception);
406
+
407
+ return;
408
+
409
+ }
410
+
411
+
412
+
413
+ Firebase.Auth.FirebaseUser newUser = task.Result;
414
+
415
+ Debug.LogFormat("User signed in successfully: {0} ({1})",
416
+
417
+ newUser.DisplayName, newUser.UserId);
418
+
419
+ });
420
+
421
+ }
422
+
423
+ ```