Changing username doesn't take effect immediately

Options
natasky
edited November 2013 in Native
Hi,

I'm using Photon Cloud AndroidNDK SDK.

At player A, I'm creating a LoadBalancing::Client object with some username. Then, after successfully connecting, I'm trying to change the username, by calling:
[code2=cpp]myClient.getLocalPlayer().setName("newUsername");[/code2]
(myClient is a LoadBalancing::Client object).

Then, when player B checks if "newUsername" is online, using opFindFriends, it gets a negative result (offline).

This gets resolved if player A reconnects, joins a room or leaves a room.

Is there any way to make the username change immediately visible to other players using opFindFriends without reconnecting?

Thanks!

Comments

  • Kaiserludi
    Options
    Hi natasky.

    No, it is not currently supported to change the value of the built-in player name on the fly AND use friend lists. Its either one or the other.

    You could simply not allow a name-change when being inside a mach, but only when one is in the main menu of the game and there its shouldn't really hurt to show a "please wait", while doing a reconnect under the hood, that's just not communicated to the player as such.

    findFriends is not intended to search for strings that are provided by user input, but rather for unique ids that never ever change. If you want to present a changeable name to the user, then add it as a custom property to the player. If player a adds player b to its friendlist and at that time player b is called "bill", then later b renames itself to "charlie", then simply update the custom property to present the new name to the other players. You can now present a friendlist to a, by presenting those custom property on screen names, but to opFindFriend() you don't pass the display names, but the unique and unchangeable player ids that you have specified for LoadBalancings builtin player name property.
  • OK, thanks for the quick reply :)