question

Green Papaya avatar image
Green Papaya asked

Multiplayer Server - Create Build With Managed Container

Struggling creating a build. Error mentions Invalid Parameters. Not sure which parameter is invalid.

Any thoughts on where my mistake is?

void CreateBuild()
    {
        List<PlayFab.MultiplayerModels.Port> ports = new List<PlayFab.MultiplayerModels.Port>();


        PlayFab.MultiplayerModels.Port port = new PlayFab.MultiplayerModels.Port();
        port.Name = "game_port";
        port.Num = 5127;
        port.Protocol = PlayFab.MultiplayerModels.ProtocolType.TCP;


        ports.Add(port);


        List<PlayFab.MultiplayerModels.AssetReferenceParams> assets = new List<PlayFab.MultiplayerModels.AssetReferenceParams>();


        PlayFab.MultiplayerModels.AssetReferenceParams assetReferenceParams = new PlayFab.MultiplayerModels.AssetReferenceParams();
        assetReferenceParams.FileName = "TNetPlayfab.zip";
        assetReferenceParams.MountPath = "C://Assets";


        assets.Add(assetReferenceParams);


        List<PlayFab.MultiplayerModels.BuildRegionParams> buildRegionParams = new List<PlayFab.MultiplayerModels.BuildRegionParams>();


        PlayFab.MultiplayerModels.BuildRegionParams buildRegionParam = new PlayFab.MultiplayerModels.BuildRegionParams();
        buildRegionParam.Region = "EastUs";
        buildRegionParam.MaxServers = 2;
        buildRegionParam.StandbyServers = 1;


        buildRegionParams.Add(buildRegionParam);


        PlayFabMultiplayerAPI.CreateBuildWithManagedContainer(new PlayFab.MultiplayerModels.CreateBuildWithManagedContainerRequest()
        {
            AuthenticationContext = new PlayFabAuthenticationContext() { EntityToken = TitleEntityToken.EntityToken },
            BuildName = "TNet",
            GameAssetReferences = assets,
            MultiplayerServerCountPerVm = 1,
            Ports = ports,
            RegionConfigurations = buildRegionParams,
            StartMultiplayerServerCommand = "C://Assets//TNetPlayfab.exe -nographics -batchmode -logFile C://GameLogs//UnityEditor.log",
            VmSize = PlayFab.MultiplayerModels.AzureVmSize.Standard_A1_v2


        },
       result =>
       {


           Debug.Log("Success: " + result.BuildId);
       },
        error => { 
            Debug.Log(error.GenerateErrorReport());
            Debug.Log(error.ErrorDetails);
            Debug.Log(error.ErrorMessage);
            Debug.Log(error.Error);
        }); 
    }
playfab.png (114.9 KiB)
10 |1200

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

Seth Du avatar image
Seth Du answered

I have reproduced and fixed this issue in my testing project.

It seems that you will need to specify ContainerFlavor in the request of API of Unity SDK. Simply adding the following code in the request will solve this issue.

ContainerFlavor = PlayFab.MultiplayerModels.ContainerFlavor.ManagedWindowsServerCore,

Besides, the directory path should use "\\" instead of "//" :

StartMultiplayerServerCommand="C:\\Assets\\TNetPlayfab.exe -nographics -batchmode -logFile C:\\GameLogs\\UnityEditor.log",
10 |1200

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

Seth Du avatar image
Seth Du answered

I don’t find other issues besides of region value assignment. buildRegionParam.Region is not string, and is an enumerable value of PlayFab.MultiplayerModels.AzureRegion. You may replace the Line 30 with the following.

buildRegionParam.Region = PlayFab.MultiplayerModels.AzureRegion.EastUs;

Please feel free to tell us if you have any other issues after the assignment error has been fixed.

3 comments
10 |1200

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

Green Papaya avatar image Green Papaya commented ·

That does not appear to work:

0 Likes 0 ·
region.png (117.5 KiB)
Seth Du avatar image Seth Du ♦ Green Papaya commented ·

May I ask are you using C# SDK or Unity SDK? What's the version of the SDK?

The property type seems to be different in my testing environment.

0 Likes 0 ·
Green Papaya avatar image Green Papaya commented ·

@SethDu I am using this:

I also installed this on a blank project and upgraded the SDK to the latest version. The region still needs to be a string. Unity 2019.4.12f1

0 Likes 0 ·
sdk.png (136.6 KiB)

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.