diff --git a/sdks/unity/AgonesSdk.cs b/sdks/unity/AgonesSdk.cs index e202110823..b8a8bf8a77 100644 --- a/sdks/unity/AgonesSdk.cs +++ b/sdks/unity/AgonesSdk.cs @@ -91,10 +91,11 @@ private void OnApplicationQuit() /// Async method that waits to connect to the SDK Server. Will timeout /// and return false after 30 seconds. /// + /// The number of seconds to wait before timing out. Defaults to 30 seconds. /// A task that indicated whether it was successful or not - public async Task Connect() + public async Task Connect(int timeoutSeconds = 30) { - for (var i = 0; i < 30; i++) + for (var i = 0; i < timeoutSeconds; i++) { Log($"Attempting to connect...{i + 1}"); try diff --git a/site/content/en/docs/Guides/Client SDKs/unity.md b/site/content/en/docs/Guides/Client SDKs/unity.md index 0e8dd9e414..1639a4a514 100644 --- a/site/content/en/docs/Guides/Client SDKs/unity.md +++ b/site/content/en/docs/Guides/Client SDKs/unity.md @@ -82,8 +82,8 @@ var agones = agonesGameObject.GetComponent(); ``` To connect to the SDK server, either local or when running on Agones, run the async `Connect()` method. -This will wait for up to 30 seconds if the SDK server has not yet started and the connection cannot be made, -and will return `false` if there was an issue connecting. +By default, this will wait for up to 30 seconds if the SDK server has not yet started and the connection cannot be made. You can specify an optional timeout duration argument to the method, e.g., Connect(60) for a 60-second timeout. +The method will return `false` if there was an issue connecting. ```csharp bool ok = await agones.Connect();