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 What is the structure of GetPayloadAllocationAsPlainText()?

Discussion in 'Game Server Hosting' started by CodeMonkeyYT, Mar 11, 2023.

  1. CodeMonkeyYT

    CodeMonkeyYT

    Joined:
    Dec 22, 2014
    Posts:
    125
    Hi there,

    There's a function GetPayloadAllocationAsPlainText();
    And another GetPayloadAllocationFromJsonAs<TPayload>();

    What data does this return? I can't find any mention in the docs.

    Thanks!
     
  2. CodeMonkeyYT

    CodeMonkeyYT

    Joined:
    Dec 22, 2014
    Posts:
    125
    For anyone else who wants to know apparently it returns this structure
    Code (CSharp):
    1. [Serializable]
    2.     public class PayloadAllocation {
    3.         public Unity.Services.Matchmaker.Models.MatchProperties MatchProperties;
    4.         public string GeneratorName;
    5.         public string QueueName;
    6.         public string PoolName;
    7.         public string EnvironmentId;
    8.         public string BackfillTicketId;
    9.         public string MatchId;
    10.         public string PoolId;
    11.     }
    Which you can get with
    Code (CSharp):
    1. PayloadAllocation payloadAllocation = await MultiplayService.Instance.GetPayloadAllocationFromJsonAs<PayloadAllocation>();
     
  3. earthcrosser

    earthcrosser

    Joined:
    Oct 13, 2010
    Posts:
    123
    Just sharing an experience with that line of code that Codemonkey shared. I had Multiplay 1.0.3 installed and I was getting Failed to Deserialize error on the server. I upgraded my Multiplay version to 1.0.5 and the problem went away. So just sharing in case anyone else hits that error.