question

muhammetkaya avatar image
muhammetkaya asked

How to Create Lobby? Unity

Hello all, I am trying to create lobby. But I got error like "The list of members is empty". How can i fix it? Here is my code. I couldn't find any documention about creating lobby in unity.

public void CreateLobby() {

     var createRequest = new CreateLobbyRequest()
     { 
         MaxPlayers = 2,
        OwnerMigrationPolicy =  OwnerMigrationPolicy.None,
        Owner = new PlayFab.MultiplayerModels.EntityKey()
        {
            Type = _entityKey.Type,
            Id = _entityKey.Id
        },
        UseConnections = true,
     };

     PlayFabMultiplayerAPI.CreateLobby(createRequest,
         result => { message.text = "Created lobby";},
         OnError 
     );
        
        
 }
multiplayer
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
Xiao Zha avatar image
Xiao Zha answered

Calling the CreateLobby API requires setting the Members parameter in the API request, which is the members initially added to the lobby, and the creator's entity must be added to the members parameter.

1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

muhammetkaya avatar image muhammetkaya commented ·

Hello, It worked but why you do not share example codes? I can not find any examples in document. Actually there are but only in C++. Can you improve documentation please?

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.