Skip to content

Commit

Permalink
Release 11.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
UnityAidas committed Jan 29, 2024
1 parent 82434f7 commit d7674e6
Show file tree
Hide file tree
Showing 44 changed files with 1,165 additions and 13 deletions.
19 changes: 19 additions & 0 deletions com.unity.asset-store-tools/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,25 @@
# Changelog
All notable changes to this package will be documented in this file.

## [11.4.0] - 2024-01-23

### Uploader Changes
- Added prevention of uploading packages larger than 6 GB
- Added a prompt to allow automatically generating meta files within hidden folders
- Fixed some obsolete API usage warnings in newer Unity versions

### Validator Changes
- Added validation tests for:
- Animation Clip take names
- Model import logs
- Uncompressed Package size
- Updated the fail severity of Audio Clipping validation test
- Updated the Demo Scene test to treat default scenes with custom skyboxes as valid demo scenes
- Fixed some obsolete API usage warnings in newer Unity versions

### Other
- Added an option to check for Asset Store Publishing Tools updates

## [11.3.1] - 2023-08-14

### Uploader Changes
Expand Down
7 changes: 7 additions & 0 deletions com.unity.asset-store-tools/Editor/AssetStoreTools.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,13 @@ public static void OpenFeedback()
Application.OpenURL("https://forum.unity.com/threads/new-asset-store-tools-version-coming-july-20th-2022.1310939/");
}

[MenuItem("Asset Store Tools/Check for Updates", false, 45)]
public static void OpenUpdateChecker()
{
var wnd = GetWindowWithRect<ASToolsUpdater>(new Rect(Screen.width / 2, Screen.height / 2, 400, 150), true);
wnd.Show();
}

[MenuItem("Asset Store Tools/Settings", false, 50)]
public static void OpenSettings()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ namespace AssetStoreTools.Uploader
internal class AssetStoreUploader : AssetStoreToolsWindow
{
public const string MinRequiredPackageVersion = "2021.3";
public const long MaxPackageSizeBytes = 6442450944; // 6 GB

private const string MainWindowVisualTree = "Packages/com.unity.asset-store-tools/Editor/Uploader/Styles/Base/BaseWindow_Main";
private const string DebugPhrase = "debug";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ namespace AssetStoreTools.Uploader
/// </summary>
internal static class AssetStoreAPI
{
public const string ToolVersion = "V6.3.1";
public const string ToolVersion = "V6.4.0";

private const string UnauthSessionId = "26c4202eb475d02864b40827dfff11a14657aa41";
private const string KharmaSessionId = "kharma.sessionid";
Expand Down Expand Up @@ -556,6 +556,28 @@ public static void AbortPackageUpload(string packageId)
#endregion

#region Utility Methods

public static async Task<APIResult> GetLatestAssetStoreToolsVersion()
{
try
{
var url = "https://api.assetstore.unity3d.com/package/latest-version/115";
var result = await httpClient.GetAsync(url);

result.EnsureSuccessStatusCode();

var resultStr = await result.Content.ReadAsStringAsync();

var json = JSONParser.SimpleParse(resultStr);

return new APIResult() { Success = true, Response = json };
}
catch (Exception e)
{
return new APIResult() { Success = false, Error = ASError.GetGenericError(e) };
}
}

private static string GetLicenseHash()
{
return UnityEditorInternal.InternalEditorUtility.GetAuthToken().Substring(0, 40);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using UnityEditor;
using System;
using UnityEditor;
using UnityEngine.Analytics;

namespace AssetStoreTools.Uploader.Data
Expand All @@ -14,12 +15,19 @@ internal static class ASAnalytics

static bool EnableAnalytics()
{
#if UNITY_2023_2_OR_NEWER
return true;
#else
var result = EditorAnalytics.RegisterEventWithLimit(EventName, MaxEventsPerHour, MaxNumberOfElements, VendorKey, VersionId);
return result == AnalyticsResult.Ok;
#endif
}

[System.Serializable]
public struct AnalyticsData
#if UNITY_2023_2_OR_NEWER
: IAnalytic.IData
#endif
{
public string ToolVersion;
public string PackageId;
Expand All @@ -33,14 +41,40 @@ public struct AnalyticsData
public string EndpointUrl;
}

#if UNITY_2023_2_OR_NEWER
[AnalyticInfo(eventName: EventName, vendorKey: VendorKey, version: VersionId, maxEventsPerHour: MaxEventsPerHour, maxNumberOfElements: MaxNumberOfElements)]
private class AssetStoreToolsAnalytic : IAnalytic
{
private AnalyticsData _data;

public AssetStoreToolsAnalytic(AnalyticsData data)
{
_data = data;
}

public bool TryGatherData(out IAnalytic.IData data, out Exception error)
{
error = null;
data = _data;
return data != null;
}
}
#endif

public static void SendUploadingEvent(AnalyticsData data)
{
if (!EditorAnalytics.enabled)
return;

if (!EnableAnalytics())
return;

#if UNITY_2023_2_OR_NEWER
var analytic = new AssetStoreToolsAnalytic(data);
EditorAnalytics.SendAnalytic(analytic);
#else
EditorAnalytics.SendEventWithLimit(EventName, data, VersionId);
#endif
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,24 @@ private async Task<ExportResult> ExportPackage(string outputPath)
return exportResult;
}

private bool ValidatePackageSize(string packagePath)
{
long packageSize = new FileInfo(packagePath).Length;
long packageSizeLimit = AssetStoreUploader.MaxPackageSizeBytes;
float packageSizeInGB = packageSize / (1024f * 1024f * 1024f);
float maxPackageSizeInGB = packageSizeLimit / (1024f * 1024f * 1024f);

if (packageSizeInGB - maxPackageSizeInGB < 0.1f)
return true;

var message = $"The size of your package ({packageSizeInGB:0.#} GB) exceeds the maximum allowed package size of {maxPackageSizeInGB:0.#} GB.\n\n" +
$"Please reduce the size of your package.";

EditorUtility.DisplayDialog("Asset Store Tools", message, "OK");

return false;
}

private bool ValidateUnityVersionsForUpload()
{
if (!AssetStoreUploader.ShowPackageVersionDialog)
Expand Down Expand Up @@ -488,6 +506,9 @@ private async void PreparePackageUpload()
return;
}

if (!ValidatePackageSize(exportResult.ExportedPath))
return;

if (!ValidateUnityVersionsForUpload())
return;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,8 @@ private void HandleFolderUploadPathSelection(string relativeExportPath, List<str
if (dependencies != null && dependencies.Count != 0)
FindAndPopulateDependencies(dependencies);

// After setting up the main and extra paths update validation paths
// After setting up the main and extra paths, check for missing metas and update validation paths
CheckForMissingMetas();
UpdateValidationPaths();

// Only serialize current selection when no serialized toggles were passed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,8 @@ private void HandleHybridUploadPathSelection(string relativeExportPath, string r
if (pathsToAdd.Count != 0)
PopulateExtraPackagesBox(pathsToAdd, serializedToggles);

// After setting up the main and extra paths update validation paths
// After setting up the main and extra paths, check for missing metas and update validation paths
CheckForMissingMetas();
UpdateValidationPaths();

if (serializeValues)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,36 @@ private string DeserializePath(JsonValue pathDict)
return exportPath;
}

protected void CheckForMissingMetas()
{
if (ASToolsPreferences.Instance.DisplayHiddenMetaDialog && FileUtility.IsMissingMetaFiles(GetAllExportPaths()))
{
var selectedOption = EditorUtility.DisplayDialogComplex(
"Notice",
"Your package includes hidden folders which do not contain meta files. " +
"Hidden folders will not be exported unless they contain meta files.\n\nWould you like meta files to be generated?",
"Yes", "No", "No and do not display this again");

switch (selectedOption)
{
case 0:
FileUtility.GenerateMetaFiles(GetAllExportPaths());
EditorUtility.DisplayDialog(
"Success",
"Meta files have been generated. Please note that further manual tweaking may be required to set up correct references",
"OK");
break;
case 1:
// Do nothing
return;
case 2:
ASToolsPreferences.Instance.DisplayHiddenMetaDialog = false;
ASToolsPreferences.Instance.Save();
return;
}
}
}

public bool GetValidationSummary(out string validationSummary)
{
return ValidationElement.GetValidationSummary(out validationSummary);
Expand Down
18 changes: 18 additions & 0 deletions com.unity.asset-store-tools/Editor/Utility/ASToolsPreferences.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,21 @@ private ASToolsPreferences()

private void Load()
{
CheckForUpdates = PlayerPrefs.GetInt("AST_CheckForUpdates", 1) == 1;
LegacyVersionCheck = PlayerPrefs.GetInt("AST_LegacyVersionCheck", 1) == 1;
UploadVersionCheck = PlayerPrefs.GetInt("AST_UploadVersionCheck", 1) == 1;
DisplayHiddenMetaDialog = PlayerPrefs.GetInt("AST_HiddenFolderMetaCheck", 1) == 1;
EnableSymlinkSupport = PlayerPrefs.GetInt("AST_EnableSymlinkSupport", 0) == 1;
UseLegacyExporting = PlayerPrefs.GetInt("AST_UseLegacyExporting", 0) == 1;
DisplayUploadDialog = PlayerPrefs.GetInt("AST_DisplayUploadDialog", 0) == 1;
}

public void Save(bool triggerSettingsChange = false)
{
PlayerPrefs.SetInt("AST_CheckForUpdates", CheckForUpdates ? 1 : 0);
PlayerPrefs.SetInt("AST_LegacyVersionCheck", LegacyVersionCheck ? 1 : 0);
PlayerPrefs.SetInt("AST_UploadVersionCheck", UploadVersionCheck ? 1 : 0);
PlayerPrefs.SetInt("AST_HiddenFolderMetaCheck", DisplayHiddenMetaDialog ? 1 : 0);
PlayerPrefs.SetInt("AST_EnableSymlinkSupport", EnableSymlinkSupport ? 1 : 0);
PlayerPrefs.SetInt("AST_UseLegacyExporting", UseLegacyExporting ? 1 : 0);
PlayerPrefs.SetInt("AST_DisplayUploadDialog", DisplayUploadDialog ? 1 : 0);
Expand All @@ -41,6 +45,11 @@ public void Save(bool triggerSettingsChange = false)
OnSettingsChange?.Invoke();
}

/// <summary>
/// Periodically check if an update for the Asset Store Publishing Tools is available
/// </summary>
public bool CheckForUpdates;

/// <summary>
/// Check if legacy Asset Store Tools are in the Project
/// </summary>
Expand All @@ -51,6 +60,11 @@ public void Save(bool triggerSettingsChange = false)
/// </summary>
public bool UploadVersionCheck;

/// <summary>
/// Enables a DisplayDialog when hidden folders are found to be missing meta files
/// </summary>
public bool DisplayHiddenMetaDialog;

/// <summary>
/// Enables Junction symlink support
/// </summary>
Expand All @@ -73,8 +87,10 @@ internal class ASToolsPreferencesProvider : SettingsProvider

private class Styles
{
public static readonly GUIContent CheckForUpdatesLabel = EditorGUIUtility.TrTextContent("Check for Updates", "Periodically check if an update for the Asset Store Publishing Tools is available.");
public static readonly GUIContent LegacyVersionCheckLabel = EditorGUIUtility.TrTextContent("Legacy ASTools Check", "Enable Legacy Asset Store Tools version checking.");
public static readonly GUIContent UploadVersionCheckLabel = EditorGUIUtility.TrTextContent("Upload Version Check", "Check if the package has been uploader from a correct Unity version at least once.");
public static readonly GUIContent DisplayHiddenMetaDialogLabel = EditorGUIUtility.TrTextContent("Display Hidden Folder Meta Dialog", "Show a DisplayDialog when hidden folders are found to be missing meta files.\nNote: this only affects hidden folders ending with a '~' character");
public static readonly GUIContent EnableSymlinkSupportLabel = EditorGUIUtility.TrTextContent("Enable Symlink Support", "Enable Junction Symlink support. Note: folder selection validation will take longer.");
public static readonly GUIContent UseLegacyExportingLabel = EditorGUIUtility.TrTextContent("Use Legacy Exporting", "Enabling this option uses native Unity methods when exporting packages for the Folder Upload workflow.\nNote: individual package dependency selection when choosing to 'Include Package Manifest' is unavailable when this option is enabled.");
public static readonly GUIContent DisplayUploadDialogLabel = EditorGUIUtility.TrTextContent("Display Upload Dialog", "Show a DisplayDialog after the package uploading has finished.");
Expand All @@ -94,8 +110,10 @@ public override void OnGUI(string searchContext)
EditorGUI.BeginChangeCheck();
using (CreateSettingsWindowGUIScope())
{
preferences.CheckForUpdates = EditorGUILayout.Toggle(Styles.CheckForUpdatesLabel, preferences.CheckForUpdates);
preferences.LegacyVersionCheck = EditorGUILayout.Toggle(Styles.LegacyVersionCheckLabel, preferences.LegacyVersionCheck);
preferences.UploadVersionCheck = EditorGUILayout.Toggle(Styles.UploadVersionCheckLabel, preferences.UploadVersionCheck);
preferences.DisplayHiddenMetaDialog = EditorGUILayout.Toggle(Styles.DisplayHiddenMetaDialogLabel, preferences.DisplayHiddenMetaDialog);
preferences.EnableSymlinkSupport = EditorGUILayout.Toggle(Styles.EnableSymlinkSupportLabel, preferences.EnableSymlinkSupport);
preferences.UseLegacyExporting = EditorGUILayout.Toggle(Styles.UseLegacyExportingLabel, preferences.UseLegacyExporting);
preferences.DisplayUploadDialog = EditorGUILayout.Toggle(Styles.DisplayUploadDialogLabel, preferences.DisplayUploadDialog);
Expand Down
Loading

0 comments on commit d7674e6

Please sign in to comment.