Search Unity

The referenced script (Unknown) on this Behaviour is missing!

Discussion in 'Addressables' started by Rafarel, Mar 29, 2019.

Thread Status:
Not open for further replies.
  1. Rafarel

    Rafarel

    Joined:
    Jul 21, 2017
    Posts:
    199
    Hello,

    When I play my game in packed mode I have some warnings that are hard to fix because it gives not so much information :( The warning is : The referenced script (Unknown) on this Behaviour is missing! or something similar.

    Here is a screenshot of my console

    ReferencedSriptMissing.PNG

    Thanks !
     
  2. Deleted User

    Deleted User

    Guest

    I have the same issue when going back and forth between scenes, both in standalone and editor packed mode. Some objects are randomly missing scripts while instantiating them. The Animator doesn't load properly and sprites end up having the internal error shader (pink). I'm trying to find repro steps to provide a sample projet, without success yet. It started happening when I updated from 0.4.8 to 0.6.7.
     
  3. Rafarel

    Rafarel

    Joined:
    Jul 21, 2017
    Posts:
    199
    I managed to remove the warnings by identifying the prefabs that misses script reference, delete them and make new ones. But if I do fix errors with the addressables analyse tool, the warnings are back for the same 3 prefabs, even if it a new one that I re-created.

    The game is working in editor but not in the built version

    Any idea @unity_bill ? I really need help on this one :)

    On the built version, I can't go from menu scene to the game because I have this "corrupted" prefabs that crash the game.

    Here is my log from the build version :

    Mono path[0] = 'C:/Users/rafar/git/ClaytusTowerDefense/Build/WIN64/ClaytusTowerDefense_Data/Managed'
    Mono config path = 'C:/Users/rafar/git/ClaytusTowerDefense/Build/WIN64/MonoBleedingEdge/etc'
    PlayerConnection initialized from C:/Users/rafar/git/ClaytusTowerDefense/Build/WIN64/ClaytusTowerDefense_Data (debug = 0)
    PlayerConnection initialized network socket : 0.0.0.0 55015
    Multi-casting "[IP] 192.168.0.13 [Port] 55015 [Flags] 2 [Guid] 3419443580 [EditorId] 349798411 [Version] 1048832 [Id] WindowsPlayer(Rafarel-PC) [Debug] 0 [PackageName] WindowsPlayer" to [225.0.0.222:54997]...
    Started listening to [0.0.0.0:55015]
    PlayerConnection already initialized - listening to [0.0.0.0:55015]
    Initialize engine version: 2018.3.11f1 (5063218e4ab8)
    GfxDevice: creating device client; threaded=1
    Direct3D:
    Version: Direct3D 11.0 [level 11.1]
    Renderer: NVIDIA GeForce GTX 970 (ID=0x13c2)
    Vendor:
    VRAM: 4043 MB
    Driver: 25.21.14.1634
    Begin MonoManager ReloadAssembly
    - Completed reload, in 1.507 seconds
    <RI> Initializing input.

    <RI> Input initialized.

    <RI> Initialized touch support.

    UnloadTime: 1.504982 ms
    The referenced script (Unknown) on this Behaviour is missing!

    (Filename: C:\buildslave\unity\build\Runtime/Scripting/ManagedReference/SerializableManagedRef.cpp Line: 195)

    The referenced script on this Behaviour (Game Object '') is missing!

    (Filename: C:\buildslave\unity\build\Runtime/Mono/ManagedMonoBehaviourRef.cpp Line: 294)

    The referenced script (Unknown) on this Behaviour is missing!

    (Filename: C:\buildslave\unity\build\Runtime/Scripting/ManagedReference/SerializableManagedRef.cpp Line: 195)

    The referenced script on this Behaviour (Game Object '') is missing!

    (Filename: C:\buildslave\unity\build\Runtime/Mono/ManagedMonoBehaviourRef.cpp Line: 294)

    The referenced script (Unknown) on this Behaviour is missing!

    (Filename: C:\buildslave\unity\build\Runtime/Scripting/ManagedReference/SerializableManagedRef.cpp Line: 195)

    The referenced script on this Behaviour (Game Object 'TextMeshPro Text') is missing!

    (Filename: C:\buildslave\unity\build\Runtime/Mono/ManagedMonoBehaviourRef.cpp Line: 294)

    The file 'none' is corrupted! Remove it and launch unity again!
    [Position out of bounds!]
    UnityEngine.Object:Internal_CloneSingle(Object)
    UnityEngine.Object:Instantiate(GameObject)
    LevelSelectionPanel:Start() (at C:\Users\rafar\git\ClaytusTowerDefense\Assets\Scripts\UI\LevelSelectionPanel.cs:18)

    [C:\buildslave\unity\build\Runtime/Serialize/SerializationCaching/CachedReader.cpp line 214]
    (Filename: C:/Users/rafar/git/ClaytusTowerDefense/Assets/Scripts/UI/LevelSelectionPanel.cs Line: 18)

    The file 'none' is corrupted! Remove it and launch unity again!
    [Position out of bounds!]
    UnityEngine.Object:Internal_CloneSingle(Object)
    UnityEngine.Object:Instantiate(GameObject)
    LevelSelectionPanel:Start() (at C:\Users\rafar\git\ClaytusTowerDefense\Assets\Scripts\UI\LevelSelectionPanel.cs:18)

    [C:\buildslave\unity\build\Runtime/Serialize/SerializationCaching/CachedReader.cpp line 220]
    (Filename: C:/Users/rafar/git/ClaytusTowerDefense/Assets/Scripts/UI/LevelSelectionPanel.cs Line: 18)

    The file 'none' is corrupted! Remove it and launch unity again!
    [Position out of bounds!]
    UnityEngine.Object:Internal_CloneSingle(Object)
    UnityEngine.Object:Instantiate(GameObject)
    LevelSelectionPanel:Start() (at C:\Users\rafar\git\ClaytusTowerDefense\Assets\Scripts\UI\LevelSelectionPanel.cs:18)

    [C:\buildslave\unity\build\Runtime/Serialize/SerializationCaching/CachedReader.cpp line 214]
    (Filename: C:/Users/rafar/git/ClaytusTowerDefense/Assets/Scripts/UI/LevelSelectionPanel.cs Line: 18)

    The file 'none' is corrupted! Remove it and launch unity again!
    [Position out of bounds!]
    UnityEngine.Object:Internal_CloneSingle(Object)
    UnityEngine.Object:Instantiate(GameObject)
    LevelSelectionPanel:Start() (at C:\Users\rafar\git\ClaytusTowerDefense\Assets\Scripts\UI\LevelSelectionPanel.cs:18)

    [C:\buildslave\unity\build\Runtime/Serialize/SerializationCaching/CachedReader.cpp line 220]
    (Filename: C:/Users/rafar/git/ClaytusTowerDefense/Assets/Scripts/UI/LevelSelectionPanel.cs Line: 18)

    The file 'none' is corrupted! Remove it and launch unity again!
    [Position out of bounds!]
    UnityEngine.Object:Internal_CloneSingle(Object)
    UnityEngine.Object:Instantiate(GameObject)
    LevelSelectionPanel:Start() (at C:\Users\rafar\git\ClaytusTowerDefense\Assets\Scripts\UI\LevelSelectionPanel.cs:18)

    [C:\buildslave\unity\build\Runtime/Serialize/SerializationCaching/CachedReader.cpp line 214]
    (Filename: C:/Users/rafar/git/ClaytusTowerDefense/Assets/Scripts/UI/LevelSelectionPanel.cs Line: 18)

    The file 'none' is corrupted! Remove it and launch unity again!
    [Position out of bounds!]
    UnityEngine.Object:Internal_CloneSingle(Object)
    UnityEngine.Object:Instantiate(GameObject)
    LevelSelectionPanel:Start() (at C:\Users\rafar\git\ClaytusTowerDefense\Assets\Scripts\UI\LevelSelectionPanel.cs:18)

    [C:\buildslave\unity\build\Runtime/Serialize/SerializationCaching/CachedReader.cpp line 220]
    (Filename: C:/Users/rafar/git/ClaytusTowerDefense/Assets/Scripts/UI/LevelSelectionPanel.cs Line: 18)

    The file 'none' is corrupted! Remove it and launch unity again!
    [Position out of bounds!]
    UnityEngine.Object:Internal_CloneSingle(Object)
    UnityEngine.Object:Instantiate(GameObject)
    LevelSelectionPanel:Start() (at C:\Users\rafar\git\ClaytusTowerDefense\Assets\Scripts\UI\LevelSelectionPanel.cs:18)

    [C:\buildslave\unity\build\Runtime/Serialize/SerializationCaching/CachedReader.cpp line 214]
    (Filename: C:/Users/rafar/git/ClaytusTowerDefense/Assets/Scripts/UI/LevelSelectionPanel.cs Line: 18)

    The file 'none' is corrupted! Remove it and launch unity again!
    [Position out of bounds!]
    UnityEngine.Object:Internal_CloneSingle(Object)
    UnityEngine.Object:Instantiate(GameObject)
    LevelSelectionPanel:Start() (at C:\Users\rafar\git\ClaytusTowerDefense\Assets\Scripts\UI\LevelSelectionPanel.cs:18)

    [C:\buildslave\unity\build\Runtime/Serialize/SerializationCaching/CachedReader.cpp line 220]
    (Filename: C:/Users/rafar/git/ClaytusTowerDefense/Assets/Scripts/UI/LevelSelectionPanel.cs Line: 18)

    The file 'none' is corrupted! Remove it and launch unity again!
    [Position out of bounds!]
    UnityEngine.Object:Internal_CloneSingle(Object)
    UnityEngine.Object:Instantiate(GameObject)
    LevelSelectionPanel:Start() (at C:\Users\rafar\git\ClaytusTowerDefense\Assets\Scripts\UI\LevelSelectionPanel.cs:18)

    [C:\buildslave\unity\build\Runtime/Serialize/SerializationCaching/CachedReader.cpp line 214]
    (Filename: C:/Users/rafar/git/ClaytusTowerDefense/Assets/Scripts/UI/LevelSelectionPanel.cs Line: 18)

    The file 'none' is corrupted! Remove it and launch unity again!
    [Position out of bounds!]
    UnityEngine.Object:Internal_CloneSingle(Object)
    UnityEngine.Object:Instantiate(GameObject)
    LevelSelectionPanel:Start() (at C:\Users\rafar\git\ClaytusTowerDefense\Assets\Scripts\UI\LevelSelectionPanel.cs:18)

    [C:\buildslave\unity\build\Runtime/Serialize/SerializationCaching/CachedReader.cpp line 220]
    (Filename: C:/Users/rafar/git/ClaytusTowerDefense/Assets/Scripts/UI/LevelSelectionPanel.cs Line: 18)

    The file 'none' is corrupted! Remove it and launch unity again!
    [Position out of bounds!]
    UnityEngine.Object:Internal_CloneSingle(Object)
    UnityEngine.Object:Instantiate(GameObject)
    LevelSelectionPanel:Start() (at C:\Users\rafar\git\ClaytusTowerDefense\Assets\Scripts\UI\LevelSelectionPanel.cs:18)

    [C:\buildslave\unity\build\Runtime/Serialize/SerializationCaching/CachedReader.cpp line 214]
    (Filename: C:/Users/rafar/git/ClaytusTowerDefense/Assets/Scripts/UI/LevelSelectionPanel.cs Line: 18)

    The file 'none' is corrupted! Remove it and launch unity again!
    [Position out of bounds!]
    UnityEngine.Object:Internal_CloneSingle(Object)
    UnityEngine.Object:Instantiate(GameObject)
    LevelSelectionPanel:Start() (at C:\Users\rafar\git\ClaytusTowerDefense\Assets\Scripts\UI\LevelSelectionPanel.cs:18)

    [C:\buildslave\unity\build\Runtime/Serialize/SerializationCaching/CachedReader.cpp line 220]
    (Filename: C:/Users/rafar/git/ClaytusTowerDefense/Assets/Scripts/UI/LevelSelectionPanel.cs Line: 18)

    Setting up 4 worker threads for Enlighten.
    Thread -> id: 4eec -> priority: 1
    Thread -> id: 4ec8 -> priority: 1
    Thread -> id: 4e48 -> priority: 1
    Thread -> id: 4f10 -> priority: 1
    ##utp:{"type":"MemoryLeaks","version":2,"phase":"Immediate","time":1554066902054,"processId":17664,"allocatedMemory":31755,"memoryLabels":[{"Default":1048},{"NewDelete":336},{"Thread":8},{"Manager":320},{"VertexData":528},{"GfxDevice":7920},{"Physics":32},{"Serialization":40},{"File":14124},{"Terrain":88},{"String":3391},{"DynamicArray":2448},{"PoolAlloc":-88},{"Sprites":8},{"CloudService":168},{"VR":536},{"SceneManager":840},{"Secure":8}]}
     
  4. Rafarel

    Rafarel

    Joined:
    Jul 21, 2017
    Posts:
    199
    When I delete all the Addressables Duplicate isolation group, the warnings disappeared but I have a
    NullReferenceException
    during runtime ... Fixing addressables duplicates again fixes the
    NullReferenceException
    but brings back the warnings described in the initial post ...
    Please tell me that this is a know issue and that it will be fixed ;)
    @unity_bill you can have access to my project if you need to.
    Have a nice day !
     
  5. unity_bill

    unity_bill

    Joined:
    Apr 11, 2017
    Posts:
    1,053
    Two things to check. For one, make sure that you redo "build player content" after doing the duplicate cleanup. Really after doing anything, so ideally do it before you build the player. Secondly, make sure when you do "build player content" it's for the same platform that you're building the player for. If you, for example, were in Android mode, then build addressables, switched to windows, and build the windows player, things would not work.
     
  6. Rafarel

    Rafarel

    Joined:
    Jul 21, 2017
    Posts:
    199
    Hello Bill,

    I'm building player content every time I want to play or build the game, plus I build only for windows at the time.
    I've updated Addressables to 0.7.4 but my issue persists, when I build the game I have these errors that I haven't in any other play mode in the editor ...

    Thanks for your support !

    DevConsole.PNG
     
  7. Rafarel

    Rafarel

    Joined:
    Jul 21, 2017
    Posts:
    199
    I'm back :)

    In fact it seems that addressables is not the issue but something that supposed to be corrupted on my unity project ...
    i can't open my Level selection panel because it crashes the built game. But If I put a test button to launch a random level anywhere else I can load the level and all is working fine.
    How can I hunt the corrupted thing ? Is there any technique or tool to analyse this kind of situation
     
  8. unity_bill

    unity_bill

    Joined:
    Apr 11, 2017
    Posts:
    1,053
    Have you tried deleting the Library folder? It makes your next Unity-launch take a long time, but that's the default fix-it for most weird issues like this.
     
  9. Rafarel

    Rafarel

    Joined:
    Jul 21, 2017
    Posts:
    199
    Hey thanks but deleting Library will preserve my collab history ? Last time I did this kind of thing I lost all my collab history ?
     
  10. bagelbaker

    bagelbaker

    Joined:
    Jun 5, 2017
    Posts:
    67
    I had this issue today and after deleting the Library folder, re-launching the project, cleaning the addressables, build player content, the problem was gone.
     
  11. Rafarel

    Rafarel

    Joined:
    Jul 21, 2017
    Posts:
    199
    @unity_bill How can I do this safely without losing all my collab history please ?
     
  12. UWE_Dushan

    UWE_Dushan

    Joined:
    Jan 7, 2015
    Posts:
    3
    I also have this problem and deleting Library didn't help.

    While investigating, I found that manually loading all the dependencies in the right order makes the issue go away so I suspect it's a bug in dependency tracking or caching.

    I'll keep digging!
     
    Rafarel likes this.
  13. UWE_Dushan

    UWE_Dushan

    Joined:
    Jan 7, 2015
    Posts:
    3
    This looks like a bug in Asset Bundle loading/dependency resolution. I narrowed it down to a fairly simple test case (see the attached project):

    - Cube and Sphere are super simple addressable prefabs with 'DestroyAfterTime' script that destroys the object after configurable amount of time (set to 5s).
    - Root is an addressable prefab that just hold a list of prefabs, configured to reference Cube and Sphere.
    - TestScene loads the Root prefab (specified by an AssetReference on the LoadRoot object) and instantiates all prefabs in its list.

    The addressable group's bundle mode is 'Pack Separately' so each prefab ends up in its own asset bundle (with Root depending on Cube and Sphere).

    Running in editor with Packed Play Mode works as expected but warns about a missing script:

    Warnings.png

    Standalone development build has "The file 'none' is corrupted!" errors and the Cube prefab fails to deserialize correctly (the DelayInSeconds value on its DestroyAfterTime component is 0, making it self destruct immediately):

    StandaloneBuild.png

    I was able to recreate this bug without Addressables, just by using the Asset Bundle API to request all 4 asset bundles (Root, Cube, Sphere and default shaders), yield until they're loaded - then async load the Root asset. According to the Asset Bundle docs, this should work as we're not loading the Root prefab until after all dependent asset bundles are loaded.

    This is a complete showstopper for us as we have fairly complex dependency graph and only need to load a small subset of all assets at any one time.

    Would it help to file a bug for this?
     

    Attached Files:

    glenneroo and Rafarel like this.
  14. Rafarel

    Rafarel

    Joined:
    Jul 21, 2017
    Posts:
    199
    This very cool that you can reproduce it, I hope Unity team (@unity_bill) will take a look at this sample!
    It it very hard to work since I'm not able to build my game :(
    Thanks a lot!
     
  15. unity_bill

    unity_bill

    Joined:
    Apr 11, 2017
    Posts:
    1,053
    Thanks for the clean repro... we'll look into it
     
  16. deeak

    deeak

    Joined:
    May 29, 2019
    Posts:
    1
     
  17. unity_bill

    unity_bill

    Joined:
    Apr 11, 2017
    Posts:
    1,053
    Alright, we've gotten to the problem, and are working on a fix. Unfortunately the fix will most likely require an engine change so it'll be a little slower to get out. Let me explain the problem, and then how it could potentially be worked around.

    We have 4 assets, A, B, C, and D. A depends on B and C. B and C each depend on D (through engine direct references). A is put in bundleA, B in bundleB, and C in bundleC. D is not explicitly put into any bundle. During the build, D will be duplicated, and pulled into both bundleB and bundleC.

    At this point, loading B or C will work fine. What won't work is loading A because of the way A has worked out it's dependencies (it sees 2 D's, and gets confused by them being the same but not the same).

    Workarounds:
    1. bundle a/b/c together.
    2. don't have one addressable contain a direct reference to another one. For example, if A had references to B & C using addressable's AssetReference, it'd be fine. Or if B & C weren't addressable, it'd be fine.

    hope that helps. we're working on a real fix so you won't have to workaround.
    -Bill
     
    Rafarel likes this.
  18. whowh

    whowh

    Joined:
    Mar 7, 2019
    Posts:
    23
    Hi @unity_bill

    Does it means we need to confirm the asset D will only have one reference?
    If using the analyze feature could avoid this issue?
    Do I can run analyze via script because I am trying to auto run analyze,update or build bundle.
    I have found the update function in ContentUpdateScript.
    But the analyze function is more complicate to use.
    How to call analyze method via script easier?

    Thanks.
     
    Last edited: May 31, 2019
  19. unity_bill

    unity_bill

    Joined:
    Apr 11, 2017
    Posts:
    1,053
    yes, the analyze functionality should be able to pull D out into it's own bundle. Which makes me realize there are 3 workarounds...
    Workarounds:
    1. bundle a/b/c together.
    2. don't have one addressable contain a direct reference to another one. For example, if A had references to B & C using addressable's AssetReference, it'd be fine. Or if B & C weren't addressable, it'd be fine.
    3. put D explicitly in it's own bundle.

    Running analyze from script is something we are working on improving, but it should be functional at a basic level now.
     
  20. unity_bill

    unity_bill

    Joined:
    Apr 11, 2017
    Posts:
    1,053
    Also, of note, from what we can tell, the system always fixes itself. So it throws the warnings, then properly loads the copies of D. So the workaround mainly gets the annoying message out of the way. If anyone has a repro where things stay broken, we'd love to see it.
     
  21. WillJey

    WillJey

    Joined:
    Feb 12, 2019
    Posts:
    6
    Hi @unity_bill

    I suffer this problems this days on Unity 2018.4.3. In My Project, D is a SubClass of MonoBehaviour. I got the "The referenced script (Unknown) on this Behaviour is missing!" when Load A Prefab. Which A direct refers B and C, and B/C has the same monobehaviour subClass type.

    This is the Inspectors of A/B/C.
    D is Some_behaviour_1(Script)
    A_B_C_D.jpg

    I has tryed the 3 workarounds...
    1. Bundle together work fine. But Its not Good for my Project as large memory usage.
    2. My team designers like direct reference, because they used to edit scene/prefab in Edit Mode.
    3. Cant Put D in its own bundle which D is a script.

    I Hope the engine fix comes soon. Sorry for poor english.
    Thanks.
     
    Last edited: Jul 8, 2019
    pyphehe likes this.
  22. unity_bill

    unity_bill

    Joined:
    Apr 11, 2017
    Posts:
    1,053
    A note on this point. Since A has direct references to B & C, then when you load A into memory, it auto-loads B & C. so I don't think you're saving any memory putting them in the separate bundles.

    also I wouldn't think your current setup addresses bullet 2 (your designers liking direct references), because opening A in the prefab editor shouldn't have B & C actually in their for editing. Right? They are just direct references of the script on A.

    So it feels like using an AssetReference here would be a good approach. maybe.
     
  23. jchowdown-asla

    jchowdown-asla

    Joined:
    May 10, 2017
    Posts:
    26
    Hi @unity_bill any chance of you guys including the guid of the missing script, so we can at least verify that it's being bundled correctly?
     
  24. unity_bill

    unity_bill

    Joined:
    Apr 11, 2017
    Posts:
    1,053
    I've confirmed this is fixed in 2019.3.0a12. It will be backported to 19.2 and 18.4, but I do not know when.
     
  25. AlkisFortuneFish

    AlkisFortuneFish

    Joined:
    Apr 26, 2013
    Posts:
    973
    It’s missed .2.1. It would be great to get some assurances that it’s gonna make .2.2, as it’s a blocking issue. In our case it locks us out of both any addressables version released this year and the 19.x cycle. With some LWRP fixes requiring 19.x this is becoming a bit of a problem.
     
  26. AlkisFortuneFish

    AlkisFortuneFish

    Joined:
    Apr 26, 2013
    Posts:
    973
    The fix has landed in 2019.2.3f1. The issues fixed are not referenced in the changelog but the fix is there. Test your projects, people! :)
     
    glenneroo and Favo-Yang like this.
  27. WillJey

    WillJey

    Joined:
    Feb 12, 2019
    Posts:
    6
    Hi all.
    That's fixed in version 1.11.2.
    I checked with unity 2018.4.19.
    Maybe Next Project I decide to use addressable.
    Thanks.
     
  28. orb_9

    orb_9

    Joined:
    Feb 10, 2010
    Posts:
    47
Thread Status:
Not open for further replies.