aws / amazon-gamelift-plugin-unity

The Amazon GameLift Plugin for Unity contains libraries and native UI that makes it easier to access GameLift resources and integrate GameLift into your Unity game. You can use the GameLift Unity Plugin to access GameLift APIs and deploy AWS CloudFormation templates for common gaming scenarios.
https://aws.amazon.com/gamelift/getting-started/
Apache License 2.0
80 stars 16 forks source link

Added missing setting #143

Closed Kyle-CW closed 10 months ago

Kyle-CW commented 10 months ago

Managed EC2 deploys were not working because the plugin failed to set CurrentBucketName in the settings file. This is a dependency in the deployers, specifically loaded into DeploymentRequestFactory and is very awkward to get StateManager to, so I have stuck with the existing implementation

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

shashankj-aws commented 10 months ago

I attempted to pull this change in locally with the following settings file

version: 1
CurrentProfileName: Default
CurrentRegion: us-east-2
UserProfiles: >+
  - Region: us-east-2

    Name: Default

    BucketName: gamelift-bootstrap-279836036313-us-east-22

    AnywhereFleetName: 

    AnywhereFleetId: 

    AnywhereFleetLocation: 

    ComputeName: 

    IpAddress: 

    WebSocketUrl: 

    DeploymentScenario: SingleRegion

    DeploymentGameName: My project (4)

    ManagedEC2FleetName: My project (4)-ManagedFleet

    BuildName: My project (4)-Single-Region_Fleet-Build

    LaunchParameters: ''

    BuildOperatingSystem: AMAZON_LINUX_2

    DeploymentBuildFilePath: C:/Users/Administrator/My project (3)/Server/My project (3).exe

    DeploymentBuildFolderPath: C:/Users/Administrator/My project (3)/Server

and i get the following exception:

The settings key was not found. 
UnityEngine.Debug:LogError (object)
AmazonGameLift.Editor.UnityLogger:Log (string,UnityEngine.LogType) (at ./Library/PackageCache/com.amazonaws.gamelift@fbc6d2797401/Editor/UnityLogger.cs:21)
AmazonGameLift.Editor.UnityLogger:LogResponseError (AmazonGameLiftPlugin.Core.Shared.Response,UnityEngine.LogType) (at ./Library/PackageCache/com.amazonaws.gamelift@fbc6d2797401/Editor/UnityLogger.cs:49)
AmazonGameLift.Editor.DeploymentSettings/<StartDeployment>d__130:MoveNext () (at ./Library/PackageCache/com.amazonaws.gamelift@fbc6d2797401/Editor/Deployment/DeploymentSettings.cs:405)
System.Runtime.CompilerServices.AsyncTaskMethodBuilder:Start<AmazonGameLift.Editor.DeploymentSettings/<StartDeployment>d__130> (AmazonGameLift.Editor.DeploymentSettings/<StartDeployment>d__130&)
AmazonGameLift.Editor.DeploymentSettings:StartDeployment (AmazonGameLift.Editor.ConfirmChangesDelegate)
AmazonGameLift.Editor.ManagedEC2Deployment:StartDeployment () (at ./Library/PackageCache/com.amazonaws.gamelift@fbc6d2797401/Editor/Window/ManagedEC2Deployment.cs:34)
AmazonGameLift.Editor.ManagedEC2Page/<>c__DisplayClass10_0:<.ctor>b__0 (UnityEngine.UIElements.ClickEvent) (at ./Library/PackageCache/com.amazonaws.gamelift@fbc6d2797401/Editor/Window/ManagedEC2Page.cs:69)
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)
Kyle-CW commented 10 months ago

I attempted to pull this change in locally with the following settings file

version: 1
CurrentProfileName: Default
CurrentRegion: us-east-2
UserProfiles: >+
  - Region: us-east-2

    Name: Default

    BucketName: gamelift-bootstrap-279836036313-us-east-22

    AnywhereFleetName: 

    AnywhereFleetId: 

    AnywhereFleetLocation: 

    ComputeName: 

    IpAddress: 

    WebSocketUrl: 

    DeploymentScenario: SingleRegion

    DeploymentGameName: My project (4)

    ManagedEC2FleetName: My project (4)-ManagedFleet

    BuildName: My project (4)-Single-Region_Fleet-Build

    LaunchParameters: ''

    BuildOperatingSystem: AMAZON_LINUX_2

    DeploymentBuildFilePath: C:/Users/Administrator/My project (3)/Server/My project (3).exe

    DeploymentBuildFolderPath: C:/Users/Administrator/My project (3)/Server

and i get the following exception:

The settings key was not found. 
UnityEngine.Debug:LogError (object)
AmazonGameLift.Editor.UnityLogger:Log (string,UnityEngine.LogType) (at ./Library/PackageCache/com.amazonaws.gamelift@fbc6d2797401/Editor/UnityLogger.cs:21)
AmazonGameLift.Editor.UnityLogger:LogResponseError (AmazonGameLiftPlugin.Core.Shared.Response,UnityEngine.LogType) (at ./Library/PackageCache/com.amazonaws.gamelift@fbc6d2797401/Editor/UnityLogger.cs:49)
AmazonGameLift.Editor.DeploymentSettings/<StartDeployment>d__130:MoveNext () (at ./Library/PackageCache/com.amazonaws.gamelift@fbc6d2797401/Editor/Deployment/DeploymentSettings.cs:405)
System.Runtime.CompilerServices.AsyncTaskMethodBuilder:Start<AmazonGameLift.Editor.DeploymentSettings/<StartDeployment>d__130> (AmazonGameLift.Editor.DeploymentSettings/<StartDeployment>d__130&)
AmazonGameLift.Editor.DeploymentSettings:StartDeployment (AmazonGameLift.Editor.ConfirmChangesDelegate)
AmazonGameLift.Editor.ManagedEC2Deployment:StartDeployment () (at ./Library/PackageCache/com.amazonaws.gamelift@fbc6d2797401/Editor/Window/ManagedEC2Deployment.cs:34)
AmazonGameLift.Editor.ManagedEC2Page/<>c__DisplayClass10_0:<.ctor>b__0 (UnityEngine.UIElements.ClickEvent) (at ./Library/PackageCache/com.amazonaws.gamelift@fbc6d2797401/Editor/Window/ManagedEC2Page.cs:69)
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)

Your setting file is missing the key that this PR adds

AWSJackson commented 10 months ago

Note, this PR is not a reasonable fix for this problem. It is only on setting the bucket in a profile. If you change profiles this line will not be triggered. So the deployment scenario will only use the bucket you last created/bootstrapped.

We are cutting a follow-up item to revert this and add the proposed fix to pass it as an argument instead of using SettingsKeys.