public void PostSuccessfulBuildAction() { var connectionResult = -1; var maxTryCount = 10; var tryCount = maxTryCount; while (tryCount-- > 0 && connectionResult == -1) { connectionResult = EditorConnectionInternal.ConnectPlayerProxy(IPAddress.Loopback.ToString(), 34999); if (EditorUtility.DisplayCancelableProgressBar("Editor Connection", "Connecting to the player", 1 - ((float)tryCount / maxTryCount))) { EditorUtility.ClearProgressBar(); throw new TestLaunchFailedException(); } } EditorUtility.ClearProgressBar(); if (connectionResult == -1) { throw new TestLaunchFailedException( "Timed out trying to connect to the player. Player failed to launch or crashed soon after launching"); } }
public void PostSuccessfulLaunchAction() { var connectionResult = -1; var maxTryCount = 100; var tryCount = maxTryCount; while (tryCount-- > 0 && connectionResult == -1) { Thread.Sleep(1000); connectionResult = EditorConnectionInternal.ConnectPlayerProxy(kDeviceAddress, kDevicePort); if (EditorUtility.DisplayCancelableProgressBar("Editor Connection", "Connecting to the player", 1 - ((float)tryCount / maxTryCount))) { EditorUtility.ClearProgressBar(); throw new TestLaunchFailedException(); } } EditorUtility.ClearProgressBar(); if (connectionResult == -1) { throw new TestLaunchFailedException( "Timed out trying to connect to the player. Player failed to launch or crashed soon after launching"); } }