Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Protocol updater #55

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Protocol updater #55

wants to merge 2 commits into from

Conversation

randymester
Copy link
Contributor

No description provided.

@@ -441,6 +453,8 @@ public static void SerializeAll()
createJson: () => new JsonObject()
{
{ ProtocolKeys.Version, protocolDataVersion },
{ ProtocolKeys.LastModifiedVersion, loadedProtocolSetVersion },
{ ProtocolKeys.LastCompatibleAppBuildNumber, PlayerSettings.iOS.buildNumber.ToString() },
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PlayerSettings.iOD.buildNumber only works in editor. See this thread: https://forum.unity.com/threads/get-build-number-from-a-script.641725/

To my knowledge, there's no straightforward way to get build number without manually serializing it out to a file. Perhaps using Application.version would work here?

@@ -233,7 +233,7 @@ public static class Rest
/// </param>
/// <param name="abortToken">Cancellation token for the request.</param>
[ItemCanBeNull]
public static async Task<WebRequestResponse> GetRequestAsync(
public static async Task<WebRequestResponseWithHandler> GetRequestAsync(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method writes the data directly to file so no handler is needed. Revert the return type back. I am using this in PolyRules and this change is breaking.

@@ -733,7 +733,7 @@ public static class Rest
/// </param>
/// <param name="abortToken">Optional cancellation token.</param>
/// <returns>The finished unity web request. Can be NULL if operation cancelled or error occurs.</returns>
private static async Task<WebRequestResponse> RunGetAsync(
private static async Task<WebRequestResponseWithHandler> RunGetAsync(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Revert to WebRequestResponse. This one is deceptive because of the naming. This method does take a file download handler so that the data is written directly to disc, which is memory-efficient for Unity compared to a standard download handler. However, this all happens and is disposed of after the request succeeds. With DownloadFileHandler, you can't directly access the bytes, which results in access exceptions. Therefore, the return type does not require a handler to be associated with it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants