Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by $$anonymous$$ · Sep 17, 2017 at 12:10 PM · mobileuser

Mobile Game with Login user using firebase SDK?

I want to make a mobile game(firebase implemented) where the user logins, and the game save score and some other things + adding leaderboards,acheivements.

1. I used the google play service to test the leaderboards and achievement,but do firebase do this all?or i have to implement the google play services with it?

2. concerning the login user and saved scores/some other stuff whats the best way to achieve this since the game is also on iOS? like the user should add/create an email and that is saved to the cloud with authentication this work on both iOS and android since i didn't use the google mail account .is this better?or the logins with his Facebook account?

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by OneCept-Games · Apr 05, 2018 at 07:04 AM

With Firebase Authentication and -Database (Realtime the only one currently supported for Unity), you can use both Email/Pasword- Facebook (an other SOME's) as well as Anonymously and your own custom authentication method, and then you can use the Database to store your highscore by UserID. I normally create shared paths in the database in the root, like: /DATABASE_URL/highscore/$uid/. And if I want to store user private data i use the path /DATABASE_URL/users/$uid/score/.
public void SyncToServer(string tableName, object items, bool sharedData=false) { if (FirebaseAuth.DefaultInstance.CurrentUser == null) { Debug.LogError("SyncWithFirebase: User is not authorized/logged in. Data will not be syncronized with server!"); return; } // Set the database root reference DatabaseReference rootRef = DataController.Instance.firebaseDatabaseRef; if (rootRef != null) { DatabaseReference usersRef; DatabaseReference uidRef; DatabaseReference tableRef; if (sharedData) tableRef = rootRef.Child(tableName); else { usersRef = rootRef.Child("users"); uidRef = usersRef.Child(FirebaseAuth.DefaultInstance.CurrentUser.UserId); tableRef = uidRef.Child(tableName); } tableRef.SetRawJsonValueAsync(JsonUtility.ToJson(items, true)).ContinueWith(task => { if (task.IsFaulted) Debug.LogError("SyncWithFirebase: " + tableName + " write failed: " + task.Exception); if (task.IsCompleted) Debug.Log("SyncWithFirebase: " + tableName + " write succeeded..."); }); } else Debug.LogError("SyncWithFirebase: Database Reference not set!"); }

tableName in this case would be "highscore" and items object in this case could be a List of a HighScore class you want to save (ie. int LevelName, int Score).

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

99 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Bullets shooting in unpredictable directions 0 Answers

Mobile FirstPersonSetup Controls Disappeared? 2 Answers

How can I play with one joystick? 0 Answers

Snow scene is a neon blue in an iOS build, but looks normal on the computer 1 Answer

Moving mobile joystick 5 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges