Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
## [1.1.4-preview] - 2019-06-19
 - Fixed an issue where Editor only types were being added to the build.
  • Loading branch information
Unity Technologies committed Jun 18, 2019
1 parent c69d321 commit c624c36
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 11 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
19 changes: 19 additions & 0 deletions Editor/Settings/AddressableAssetEntry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,8 @@ public void CreateCatalogEntries(List<ContentCatalogDataEntry> entries, bool isB
if (mainType == typeof(SceneAsset))
mainType = typeof(SceneInstance);

if (!CheckForEditorAssembly(ref mainType, assetPath))
return;

HashSet<Type> typesSeen = new HashSet<Type>();
typesSeen.Add(mainType);
Expand All @@ -477,6 +479,8 @@ public void CreateCatalogEntries(List<ContentCatalogDataEntry> 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));

Expand All @@ -489,5 +493,20 @@ public void CreateCatalogEntries(List<ContentCatalogDataEntry> 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;
}
}
}
2 changes: 1 addition & 1 deletion Runtime/ResourceLocators/ContentCatalogData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

Expand Down
24 changes: 16 additions & 8 deletions Runtime/ResourceManager/Util/ResourceManagerConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -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": [
Expand All @@ -18,6 +18,6 @@
"repository": {
"type": "git",
"url": "[email protected]:unity/Addressables.git",
"revision": "0ea6de302fcee7da30dec7f8fbe7ec957d913882"
"revision": "56c089b5af3365306e2d136d00259872bfbf0d1f"
}
}

0 comments on commit c624c36

Please sign in to comment.