Heya,
A Unity script needs to connect to a database for basic things like tracking scores, posting comments to each other, allowing features, etc. To make this work requires 2 things: 1) a way to uniquely identify users and 2) a way to allow them to recover their user should they change devices or reinstall.
Some Ideas:
- Device Unique Id:
Pros: Extremely simple. Invisible to the user, just grab id (ex: UUID uniqueIdentifier, …).
Cons: User is lost if they upgrade or switch devices. Impossible to support more than one device at the same time.
- Device Unique Id + Generated Client Key:
Pros: Still Pretty Simple. Invisible to the user. Grab device id again, but also have server generate a client key too. If they restore the game, they will still have the client key and the app can reconnect. Using multiple devices will work in many cases if they copy their player prefs settings over.
Cons: Still pretty fragile. Hard to recover if user doesn’t backup or deletes the app.
- Email (or Login) + Password:
Pros: Very secure and recoverable. User can connect from any device they want, as long as they remember their login/password. If login==email, then recovery requests are very straight forward.
Cons: Very IN-YOUR-FACE behavior. User has to give an email (or login) before they can really do anything with your app. Many games do not require a login or email or password.
Maybe a combination of #2 and #3. Start with just device id/client id but strongly encourage the user to create a name/password at some point. I’ve seen lots of games that do server side database stuff without a login or anything. Are these things just fragile? Like switching devices would completely reset? Is it acceptable for a user to lose all of their time/investment this way? What about in-app purchases?
What do you guys do?
Gigiwoo
PS - Was originally posted in IOS forum here, but I realized it was less IOS and more a general scripting problem. Should have posted it here in the first place.