Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Question Retrieve Creator name

Discussion in 'Unity User-Generated Content' started by g3nuine3, Aug 22, 2023.

  1. g3nuine3

    g3nuine3

    Joined:
    Feb 13, 2018
    Posts:
    11
    Hi,

    is it possible to retrieve the player name (as assigned with AuthenticationService.Instance.UpdatePlayerNameAsync(playerName)) from a Creator Id from Unity UGC Service?

    I only see how to retrieve the name of the current player with AuthenticationService, but I'd like to show the names of the creators besides their content.
     
  2. erickb_unity

    erickb_unity

    Unity Technologies

    Joined:
    Sep 1, 2021
    Posts:
    80
    Hello

    It is currently not possible to retrieve other player names directly from the client, it is something we will investigate on how to integrate to UGC in the future.
     
  3. richardpschubert

    richardpschubert

    Joined:
    Oct 7, 2020
    Posts:
    1
    Hey,
    A workaround to get the names displayed would be a cloud code module. For example like this:

    Code (CSharp):
    1.     [CloudCodeFunction("GetName")]
    2.     public async Task<string> GetName(IExecutionContext context, IGameApiClient gameApiClient, string playerId)
    3.     {
    4.         var response = await gameApiClient.PlayerNamesApi.GetNameAsync(context , context.ServiceToken, playerId);
    5.         return response.Data.Name;
    6.     }
     
    g3nuine3 likes this.