How do I look-up a player?
-
Hi,
Is there an API that I can use to look-up a player by name?
Ima
-
Hi,
brainCloud offers a number of APIs for looking up other players. You'll find them all in the Friend service.
As far as looking up players by name, it isn't highly recommended - since names in brainCloud are not guaranteed to be unique (and thus lookups are less deterministic and slower).
It's generally more useful to look up other players by UniversalId - which are guaranteed to be unique.
Now - maybe your app isn't using Universal Identities - so it seems odd to lookup by the UniversalId. Luckily, brainCloud supports a non-login version of a UniversalId - so you can have the user pick a Display Name which will be associated with their account, but they don't actually log in via it (and there's no password for it stored).
To use non-login UniversalIds...
- Attach the non-login identity via AttachNonLoginUniversalId()
- Later on, to update the id, use UpdateUniversalIdLogin() <-- disregard the misleading name - it works for both login and non-login versions of UniversalId
- Set the player's name to match the universalId (useful for leaderboards) via UpdateUserName()
- Finally, to look-up a player, use FindUserByExactUniversalId() or FindUserByUniversalIdStartingWith()
Hope that helps!
Paul.