Search Unity

Getting "The referenced script on this Behaviour is missing!" after updating to 2017.3

Discussion in 'Asset Bundles' started by CDF, Jan 3, 2018.

  1. CDF

    CDF

    Joined:
    Sep 14, 2013
    Posts:
    1,313
    I can't seem to solve this one. I just updated to 2017.3. Built my asset bundles and now every scene I try to load through an asset bundle results in hundreds of errors: "The referenced script on this Behaviour is missing!"

    Found this: https://issuetracker.unity3d.com/is...oading-the-asset-bundle-that-has-dependencies

    Anyone else having issues with 2017.3 and asset bundles?

    Everything looks good in my scene, no missing references, all scripts assigned.

    Gonna have to revert back to 2017.2 if I can't solve this. Very disappointing. Another Unity update, another broken game :(
     
  2. CDF

    CDF

    Joined:
    Sep 14, 2013
    Posts:
    1,313
    Ok, so I've found the issue.

    Some classes were changed after upgrading. Specifically, a serialized field of a struct that pointed to a ScriptableObject was removed. However, it looks like Unity is somehow magically keeping the reference to the ScriptableObject, even though the field doesn't exist on the class anymore!

    So I put the field back on the class, switched to debug mode, and to my surprise... saw all the old references intact!

    So... How can I remove that "feature"? I really don't like the idea of old data just hanging around in magical unity land. I've tried deleting the library, importing all assets, clearing the cache server. Yet, the references still exist. Is there a special button like "Remove old Serialized Garbage data"??
     
  3. CDF

    CDF

    Joined:
    Sep 14, 2013
    Posts:
    1,313
    More info on this. Not that anyone cares. But tracking this down further it seems like hideFlags are to blame here. The last message was a clue. If the required object had some reference to its parent object, all was good. So...

    I have a bunch of sub assets nested inside a parent asset. I set the hideFlags of these sub assets to "HideInHierarchy".
    When building the asset bundles, it would appear that they are being skipped *Unless* there is some reference to the parent asset from those sub assets.

    This reference was removed after dealing with some memory issues as it was not necessary.
    Anyway. So yeah, building the bundles with HideInHierarchy is causing Unity to strip out these assets and complain about missing scripts.

    So just for fun I decided to set the hideFlags on all sub assets to none. And no more errors!

    I'm gonna submit a bug report on this, "HideInHierarchy" shouldn't be skipping assets from being built.
     
    Last edited: Jan 4, 2018
  4. CDF

    CDF

    Joined:
    Sep 14, 2013
    Posts:
    1,313
    Bug report submitted #984453
    Also happens in 2017.2

    I really hope this is not by design. Just referencing an asset that has HideInHierarchy flags should still include it inside an asset bundle. Imo.
     
    Claytonious likes this.
  5. CDF

    CDF

    Joined:
    Sep 14, 2013
    Posts:
    1,313
    Anyone from the asset bundle team able to comment on this?

    No response on the bug report I submitted.

    If this isn't the place to discuss such things, please let me know where I should post this issue.
     
  6. CDF

    CDF

    Joined:
    Sep 14, 2013
    Posts:
    1,313
    Damn this is frustrating. Why can't I get any response on this?
    The question is simple:

    Why are sub assets not included in an asset bundle when their hideFlags = HideInHierarchy?

    If this is by design then ok. I just need to know this so I can fix my scripts and objects.
     
  7. Orion

    Orion

    Joined:
    Mar 31, 2008
    Posts:
    261
    I seem to have the same problem, but I don't even know where to start tracking these objects down. I'm trying to add AssetBundles to an already quite complex project, and hidden assets seem pretty impossible to find...

    I'm using Unity 5.6.3 though.