diff --git a/CHANGELOG.md b/CHANGELOG.md index 3456ce2c..8b199276 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,9 @@ All notable changes to this package will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## [1.1.4-preview] - 2019-06-19 + - Fixed an issue where Editor only types were being added to the build. + ## [1.1.3-preview] - 2019-06-17 - *BREAKING CODE CHANGES* - ReleaseInstance will now return a bool saying if it successfully destroyed the instance. If an instance is passed in that Addressables is unaware of, this will return false (as of 0.8 and earlier, it would print a log, and still destroy the instance). It will no longer destroy unknown instances. diff --git a/Editor/Settings/AddressableAssetEntry.cs b/Editor/Settings/AddressableAssetEntry.cs index e391effe..5d0c9e62 100644 --- a/Editor/Settings/AddressableAssetEntry.cs +++ b/Editor/Settings/AddressableAssetEntry.cs @@ -468,6 +468,8 @@ public void CreateCatalogEntries(List entries, bool isB if (mainType == typeof(SceneAsset)) mainType = typeof(SceneInstance); + if (!CheckForEditorAssembly(ref mainType, assetPath)) + return; HashSet typesSeen = new HashSet(); typesSeen.Add(mainType); @@ -477,6 +479,8 @@ public void CreateCatalogEntries(List entries, bool isB var o = objs[i]; var t = o.GetType(); var internalId = string.Format("{0}[{1}]", assetPath, o.name); + if (!CheckForEditorAssembly(ref t, internalId)) + continue; var namedAddress = string.Format("{0}.{1}", address, o.name); entries.Add(new ContentCatalogDataEntry(t, internalId, providerType, new object[] { namedAddress }, deps, extraData)); @@ -489,5 +493,20 @@ public void CreateCatalogEntries(List entries, bool isB entries.Add(new ContentCatalogDataEntry(mainType, assetPath, providerType, keyList, deps, extraData)); } + + static bool CheckForEditorAssembly(ref Type t, string internalId) + { + if (t.Assembly.IsDefined(typeof(AssemblyIsEditorAssembly), true)) + { + if (t == typeof(UnityEditor.Animations.AnimatorController)) + { + t = typeof(RuntimeAnimatorController); + return true; + } + Debug.LogWarningFormat("Type {0} is in editor assembly {1}. Asset location with internal id {2} will be stripped.", t.Name, t.Assembly.FullName, internalId); + return false; + } + return true; + } } } diff --git a/Runtime/ResourceLocators/ContentCatalogData.cs b/Runtime/ResourceLocators/ContentCatalogData.cs index c72a2ec3..c2315186 100644 --- a/Runtime/ResourceLocators/ContentCatalogData.cs +++ b/Runtime/ResourceLocators/ContentCatalogData.cs @@ -208,7 +208,7 @@ public CompactLocation(ResourceLocationMap locator, string internalId, string pr m_HashCode = internalId.GetHashCode() * 31 + providerId.GetHashCode(); m_DependencyHashCode = depHash; m_PrimaryKey = primaryKey; - m_Type = type; + m_Type = type == null ? typeof(object) : type; } } diff --git a/Runtime/ResourceManager/Util/ResourceManagerConfig.cs b/Runtime/ResourceManager/Util/ResourceManagerConfig.cs index 44fbcd62..9c5126a0 100644 --- a/Runtime/ResourceManager/Util/ResourceManagerConfig.cs +++ b/Runtime/ResourceManager/Util/ResourceManagerConfig.cs @@ -254,16 +254,24 @@ public Type Value { get { - if (string.IsNullOrEmpty(m_AssemblyName) || string.IsNullOrEmpty(m_ClassName)) - return null; - - if (m_CachedType == null) + try { - var assembly = Assembly.Load(m_AssemblyName); - if (assembly != null) - m_CachedType = assembly.GetType(m_ClassName); + if (string.IsNullOrEmpty(m_AssemblyName) || string.IsNullOrEmpty(m_ClassName)) + return null; + + if (m_CachedType == null) + { + var assembly = Assembly.Load(m_AssemblyName); + if (assembly != null) + m_CachedType = assembly.GetType(m_ClassName); + } + return m_CachedType; + } + catch (Exception ex) + { + Debug.LogException(ex); + return null; } - return m_CachedType; } set { diff --git a/package.json b/package.json index 29b75f12..e5a8dc2d 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "com.unity.addressables", "displayName": "Addressables", - "version": "1.1.3-preview", + "version": "1.1.4-preview", "unity": "2018.3", "description": "The Addressable Asset System allows the developer to ask for an asset via its address. Once an asset (e.g. a prefab) is marked \"addressable\", it generates an address which can be called from anywhere. Wherever the asset resides (local or remote), the system will locate it and its dependencies, then return it.\n\nUse 'Window->Asset Management->Addressables' to begin working with the system.\n\nAddressables use asynchronous loading to support loading from any location with any collection of dependencies. Whether you have been using direct references, traditional asset bundles, or Resource folders, addressables provide a simpler way to make your game more dynamic. Addressables simultaneously opens up the world of asset bundles while managing all the complexity.", "keywords": [ @@ -18,6 +18,6 @@ "repository": { "type": "git", "url": "git@github.cds.internal.unity3d.com:unity/Addressables.git", - "revision": "0ea6de302fcee7da30dec7f8fbe7ec957d913882" + "revision": "56c089b5af3365306e2d136d00259872bfbf0d1f" } }