13min
|
Writers
|
Updated 22 Oct 2020
Print

Setup Project



Stage 1. Import package 1. Download and import package.

Document image

2. Switch to android platform

Document image

IMPORTANT! If you don’t have a context menu "SAT" - just restart the Unity. 3. Add firebase SDK. Execute SAT => Import Firebase SDK

Document image

4. Enable Android Auto-resolution

Document image

5. Setup android project. Execute SAT => Setup Android Project

Document image

6. Import TMP. Window->TextMeshPro->Import TMP Essential Resources

Document image

7. Navigate to PlayerSetting and change Write Permission to External (SDCard)



Document image

8. Navigate to PlayerSetting and change Api Compatibility Level to .NET 4.x



Document image

9. For some unknown reason, for firebase to work fine - you must install android and ios for Unity, even if you never plan to use ios for the project. Make sure the ios module is installed, if not, install it. Restart Unity

Document image







Stage 2. Setup firebase console

1. Go to Firebase console and create new project

https://console.firebase.google.com/

Document image

2. Navigate to Setting->Project Setting

Document image

And setup iOS and Android app

Document image

Download google-services.json for android and GoogleService-Info.plist for iOS. Import files to Assets folder. Before importing, make sure that the files are named that way and not for example google-services (1).json

Document image



Document image



Document image

3. Navigate to Service accounts and generate new private key

Document image

4. Navigate to Authentication->Singn-in method and enable Email/Password provider

Document image

5. Navigate to Database create/select RealtimeDatabase

Document image
Document image

6. Navigate to Database->Rules and copy/paste this code



C#



Document image

7. Navigate to Storage->Rules and copy/paste this code

C#



Document image



Stage 3. Upload firebase cloud function

1. Install Node.js https://nodejs.org/en/ and unzip FirebaseFunctions.rar located at Assets/SocialAppTemplate/FirebaseCloudFunctions/FirebaseFunctions.rar

2. Run Command Prompt

3. cd unzipped folder (Example "cd C:\Users\uavrf\OneDrive\Desktop\FirebaseFunctions")

4 npm install npm@6.14.5 -g

5. npm install -g firebase-tools

6. firebase login

7. firebase init functions

8. Are you ready to proceed? Yes

9. What language would you like to use to write Cloud Functions? JavaScript

10. Do you want to use ESLint to catch probable bugs and enforce style? Yes

11. File functions/package.json already exists. Overwrite? No

12. File functions/.eslintrc.json already exists. Overwrite? No

13. File functions/tsconfig.json already exists. Overwrite? No

14. File functions/index.js already exists. Overwrite? No

15. File functions/.gitignore already exists. Overwrite? No

16. Do you want to install dependencies with npm now? Yes

17. firebase use --add 

18. "Select you project from list"

19. What alias do you want to use for this project? (e.g. staging) staging

20. cd functions

21. npm install tslint typescript -g

22. npm install firebase-admin@8.11.0

23. npm install firebase-functions@latest

24. npm install -g npm@6.14.5

25. npm audit fix

26. firebase deploy

27. Finally you will have this window on firebase console

Document image



if you have any questions, please contact us assets@uni-bit.com