Merge branch 'main' into aws-ts

pull/235/head
Webber Takken 2021-04-02 11:14:39 +02:00 committed by GitHub
commit 7e632cff17
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 29 additions and 22 deletions

View File

@ -1,15 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using UnityBuilderAction.Input;
using UnityBuilderAction.Reporting;
using UnityBuilderAction.Versioning;
using UnityEditor;
using UnityEditor.Build.Reporting;
#if USE_ADDRESSABLES
using UnityEditor.AddressableAssets.Settings;
#endif
using UnityEngine;
namespace UnityBuilderAction
{
@ -48,11 +45,28 @@ namespace UnityBuilderAction
if (buildPlayerOptions.target == BuildTarget.Android)
AndroidSettings.Apply(options);
// Execute default AddressableAsset content build, if the package is installed
#if USE_ADDRESSABLES
AddressableAssetSettings.CleanPlayerContent();
AddressableAssetSettings.BuildPlayerContent();
#endif
// Execute default AddressableAsset content build, if the package is installed.
// Version defines would be the best solution here, but Unity 2018 doesn't support that,
// so we fall back to using reflection instead.
var addressableAssetSettingsType = Type.GetType(
"UnityEditor.AddressableAssets.Settings.AddressableAssetSettings,Unity.Addressables.Editor");
if (addressableAssetSettingsType != null)
{
// ReSharper disable once PossibleNullReferenceException, used from try-catch
void CallAddressablesMethod(string methodName, object[] args) => addressableAssetSettingsType
.GetMethod(methodName, BindingFlags.Static | BindingFlags.Public)
.Invoke(null, args);
try
{
CallAddressablesMethod("CleanPlayerContent", new object[] { null });
CallAddressablesMethod("BuildPlayerContent", Array.Empty<object>());
}
catch (Exception e)
{
Debug.LogError($"Failed to run default addressables build:\n{e}");
}
}
// Perform build
BuildReport buildReport = BuildPipeline.BuildPlayer(buildPlayerOptions);

View File

@ -1,8 +1,6 @@
{
"name": "UnityBuilderAction",
"references": [
"Unity.Addressables.Editor"
],
"references": [],
"includePlatforms": [
"Editor"
],
@ -12,12 +10,6 @@
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": [
{
"name": "com.unity.addressables",
"expression": "1.0.0",
"define": "USE_ADDRESSABLES"
}
],
"versionDefines": [],
"noEngineReferences": false
}

View File

@ -5732,8 +5732,9 @@ xmlchars@^2.2.0:
integrity sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw==
y18n@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/y18n/-/y18n-4.0.0.tgz#95ef94f85ecc81d007c264e190a120f0a3c8566b"
version "4.0.1"
resolved "https://registry.yarnpkg.com/y18n/-/y18n-4.0.1.tgz#8db2b83c31c5d75099bb890b23f3094891e247d4"
integrity sha512-wNcy4NvjMYL8gogWWYAO7ZFWFfHcbdbE57tZO8e4cbpj8tfUcwrwqSl3ad8HxpYWCdXcJUCeKKZS62Av1affwQ==
yallist@^4.0.0:
version "4.0.0"