Play Test - Search a Player - (Unity module)
Search player by display name
To test searching for players using their display name, you need to make sure you have another player account with a display name in your namespace.
Device ID logins will create a player account without a display name by default, meaning you can't search for those players by display name.
If you don't have a player account with a display name, you can log in with your admin account using your email address and password using these launch parameters:
-AUTH_TYPE=ACCELBYTE -AUTH_LOGIN=<email> -AUTH_PASSWORD=<password>
Once you have logged in once, the user will be created in the game or studio namespace. You can now search for that user by its display name.
To search for players using their display name, follow these steps:
Play the game in Unity Editor and go to Social > Find Friends.
Type in the display name of the target user and press the Enter key.
From the results, click the Send Invite button of player you want to add. The result should look like the following:
[FriendsEssentialsWrapper_Starter] [GetUserByExactDisplayName] [327] - Successfully found users for display name: {displayName}
Search player by friend code
Since this feature does not require players to set their display name, you can invite players who logged in with a device ID on another device. You will still need to have at least two different player accounts in your game or studio namespace.
If you want to test this feature within the same machine but have implemented other login method, you can use the AGS Game SDK Randomize Device ID feature. To do so, navigate to AccelByte in the top menu bar, Edit Client Settings, expand the dropdown for Other Configs, and enable the Randomize Device ID. This feature does not randomize the device id every time, meaning you will logged in as the same user every time.
To search for players using friend codes, follow these steos:
Play the game in Unity Editor and navigate to Social > Find Friends.
Type in the friend code of the player you want to find and press the Enter key. The friend request will be sent automatically. The result should look like the following:
[FriendsEssentialsWrapper_Starter] [GetUserByFriendCode] [258] - Successfully retrieved user profile public info by public id.