Asset Bundles problem with scripts since 5.6.2

I posted already in the General support forum, but I think this is a better place for this problem. Sorry for reposting.

We are using Asset Bundles since Unity 5.2. We have a custom build pipeline (NOT the Unity provided tools from bitbucket or the browser tool from the asset store) in place which was working fine until we switched from 5.6.1 to Unity 2017.1 yesterday (or 5.6.2 today - same problem). We changed nothing in our asset bundle codebase.

Scriptable object assets and prefabs with scripts are a problem because Unity couldnā€™t find the scripts when loaded from an asset bundle. We get messages like ā€œThe referenced script on this Behaviour is missing!ā€ or ā€œThe file ā€˜noneā€™ is corrupted! Remove it and launch unity again!ā€.

The assets are fine in the editor. Itā€™s just a problem if we put the assets in asset bundles. The files are in the asset bundles if you look at the manifest file.

Our workaround is to go back to Unity 5.6.1 for now.

Has anyone else similar problems and maybe a solution?

Greetings

Tuni

Hey @Tuni
Itā€™s a known bug that we just recently fixed. It should be fixed in 2017.1f3 so make sure your 2017.1 install is fully up to date. If you are still getting that issue, please submit a bug report with a repro project.

1 Like

We tried 2017.1. Clean install, deleted the Library folder and reimported the whole project again. Same bug.

Iā€™m gonna try to create a sample project for a bug report because our current project is way too big to upload.

Ok, so there is one more issue Iā€™ve seen recently that produces the same error msg. That is if you have a Prefab with a reference to a child object of another Prefab. For example prefab layout would look like this:

Prefab 1 w/ MonoBehavior
Child 1

Prefab 2 w/ MonoBehavior that has an object reference to Child 1

This issue though we donā€™t have a fix just yet for it however are working to resolve it.

1 Like

I found another issue and a workaround for us. We load scriptable objects (will call it SO from here on) with LoadAllAssets(). This creates the same warning / error messages. LoadAsset() doesnā€™t work correctly after this (at least for short period of time).

I uploaded a very basic project with 2017.1f3. Case 930819. This project contains a simple script which loads a SO and a prefab from an asset bundle in the StreamingAssets folder.

Our workaround: We created a SO which only holds an array with references to all the other SO and load this with LoadAsset() instead all SO with LoadAllAssets().

1 Like

Thanks for the case number, Iā€™ll take a look at this shortly

1 Like

The Unity QA team has reproduced the bug.

1 Like

Hey Tuni,
Iā€™ve got a fix for that case you submitted going through the PR process now. Great repro steps and project, made is super easy to track down. Thanks!

1 Like

Pretty happy you guys are fast working into the issue, i was about to recreate all my pipeline thinking i changed something before upgrading. This need to be patched ASAP, it is game-dev stopping for me.

Ok, so the fix has gone through PR and been merged into 2017.3.0a4, and 2017.2.0b7. Itā€™s currently going through the merge process for 2017.1; it should be in 2017.1.0p4 if nothing critical happens. As for 5.5 & 5.6, Iā€™m still in queue waiting, so wonā€™t know more until it gets past approval.

1 Like

Got final approval. So fix will be in 5.6.3p1 and 5.5.4p3

1 Like

@Ryanc_unity Thank you ryan! Nice work! One question tho, do you happend to know how long do we have to wait till we get the fix on 2017.1 ?

@Leoo
I donā€™t have an exact eta for the 2017.1.0p4 release. Typically patches come out weekly to bi-weekly for the most recent Unity release and the latest path release (2017.1.0p2) was on 7/27.

Alright, the fix has been approved for the last two versions: 5.5.4p3 & 5.6.3p1.

I can confirm this has been fixed on 2017.2.0b7.

Thank you!

Well, I found the new path version updated for 5.6.3p1
But the update information is just one: Fixed Security Vulnerability UNITY-SEC-844
Has this bug been fixed?

This is the downside to stating which patch it is in before itā€™s released. Sorry all, the security update takes priority and bumped all fixes going out. It looks like the answer is a mixed bag, some unity versions will still have this fix patched in the same release time frame (and just be called the next patch number instead) and some have had their release delayed. In 5.6ā€™s case, the fix will now be in 5.6.3p2 and it was delayed slightly.

Looks like Unity is not even trying, been stuck for long time with the 5.6.1p2, any version after that is broken, and 5.6.1p2 has many issues, like tapjacking causing problem to users. How long does Unity pretend to keep us without an stability patch? This should be highest priority, without this, anyone who rely on the assetbundle system is unable to update. Iā€™ll take this into consideration next time Iā€™m ask to put my vote on using assetbundleā€™s system from Unity.

In my perspective, such blocking issue should be priority. Why would you patch things that users will not be able to use since they canā€™t even upgrade?

If you need a work around for this issue, you can use the OfType to cast and return the values from LoadAllAssets and not trigger the bug. For Example:

GameObject[ ] results = myBundle.LoadAllAssets(); // Will trigger the bug
GameObject[ ] results = myBundle.LoadAllAssets().OfType().ToArray(); // Will not trigger the bug

Another option is to write an extension method. Then when the bug is fixed, you can just update this method instead of having to change code all over the place.
public static T[ ] LoadAllAssetsFix(this UnityEngine.AssetBundle bundle)
{
return bundle.LoadAllAssets().OfType().ToArray();
}

Sorry again for the delay on getting this fixed.

1 Like

Hello,

I have update a project which is in unity 5.2.5 to unity 2017.3 p4. I have create my assetbundle from the same version as well as still I am unable to load assetbundle. Basically m_Request.isDone never gets true, I am always getting false in logs. @Ryan-Unity Can you plz help.

Here is the code :

LoadedAssetBundle bundle = AssetBundleManager.GetLoadedAssetBundle (m_AssetBundleName, out m_DownloadingError);

if(string.IsNullOrEmpty(m_DownloadingError) == false)
{
Debug.LogError("Asset bundle download error: " + m_AssetBundleName + " - " + m_DownloadingError);
return false;
}

if (bundle != null)
{

m_Request = bundle.m_AssetBundle.LoadAssetAsync (m_AssetName, m_Type);
Debug.Log (m_Request + " " + m_Request.isDone);
if (m_Request != null && m_Request.isDone)
{
AssetBundleManager.AssetBundleManifestObject = GetAsset();

return false;
}
}

return true;

What I found is , m_Request.isDone never getting true. In unity 5.2.5 this code works fine and got true but after updating its not working. Please Help !!!