LoginSignup
2
3

More than 1 year has passed since last update.

[Unity] UnityでFirebase AuthのGoogle認証をする方法の個人的メモ

Posted at

はじめに

UnityでFirebase AuthのGoogle認証を実装する方法が煩雑すぎたので、備忘録も兼ねてまとめます。
対象のプラットフォームはAndroid (とiOS?) です。

使用するツール

Unity 2021.1.14f1
external-dependency-manager 1.2.166
google-signin-plugin 1.0.4
Firebase SDK

google-signin-unityの導入

  1. google-signin-unityをインポート
  2. PlayServiceResolver/Parse/Plugins/Unity.TasksUnity.Compat を削除
  3. external-dependency-managerをインポート
  4. GoogleSignIn\Editor\m2repository\com\google\signin\google-signin-support\1.0.4\ 内の .srcaar を全て .aar に置換
    Unity Editorから google-signin-support-1.0.4 の設定を以下のように変更
    参考: https://github.com/googlesamples/google-signin-unity/issues/106
    pibrary-for-unity-fixed - Auth Scene - Android - Unity 2021.1.14f1 Personal _DX11_ 2021_10_24 17_56_27.png
  5. Assets/External Dependency Manager/Android Resolver/Resolve (or Force Resolve) からResolverを実行

Firebase Authの導入

  1. FirebaseコンソールからFirebase SDKパッケージをダウンロード
  2. dotnet3/FirebaseAuth.unitypackage をインポート
  3. Parse/Plugins/Unity.TasksUnity.Compat を削除
  4. Parse/Plugins/dotNet45/Unity.TasksUnity.Compat の設定を以下のように変更
    pibrary-for-unity-fixed - Auth Scene - Android - Unity 2021.1.14f1 Personal _DX11_ 2021_10_24 17_56_21.png
  5. Assets/External Dependency Manager/Version Handler/Update/を実行
  6. Unity Editorを再起動

おわりに

私は以下の方法でFirebase Authとgoogle-signin-unityを有効化できました。以下にgoogle-signin-unityの導入例を載せておきます。
https://github.com/Harineko0/google-signin-unity-example
https://github.com/Harineko0/pibrary-for-unity-fixed

2
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
3