Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only.

    Please, do not make any changes to your username or email addresses at id.unity.com during this transition time.

    It's still possible to reply to existing private message conversations during the migration, but any new replies you post will be missing after the main migration is complete. We'll do our best to migrate these messages in a follow-up step.

    On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live.


    Read our full announcement for more information and let us know if you have any questions.

Question Retrieve Creator name

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

  1. g3nuine3

    g3nuine3

    Joined:
    Feb 13, 2018
    Posts:
    21
    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:
    103
    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.