Search Issue Tracker
Fixed in 5.0.1
Votes
1
Found in
5.0.0f2
Issue ID
674181
Regression
No
[AssetBundle] When loading prefab from asset bundle "GameObject references runtime script in scene file. Fixing" error is thrown
Steps to reproduce this issue:
1. Open the attached project
2.Build AssetBundles (AssetBundles->Build AssetBundles from the menu)
3. Load the "Main" scene.
4. Press Play
5. Observe the errors logged ("GameObject ("name") references runtime script in scene file. Fixing!")
This also results in strange errors where MonoBehaviour fields that are initialized in Start() are null in Update() despite never being set anywhere but Start(). See the "How did testObject become null?" error appear in the console after entering playmode
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Rendering locks up when not looking at a transparent material on Meta Quest 2
- Volumetrics break when using a Custom Pass to create a Thickness Buffer for Alpha Clipping
- All tests are run instead of only the failed ones when the "Rerun Failed" button is pressed
- GameObject is not masked when the "Render PostProcessing Effects" pass executes with a resolved non-MSAA Color target and MSAA DepthStencil target
- [Android] Gfx.WaitForGfxCommandsFromMainThread high performance usage and inconsistency when built Player scene has Canvas GameObject on a specific Project
danfranklinusa
Aug 02, 2017 21:25
There is still a problem in 5.5.1f1 as far as I can tell.
If a script is referenced from a prefab, and the script (class) is renamed but it keeps the same GUID, then the prefab stays unchanged, and the AssetFileHash is unchanged, but the asset bundle file itself is different!
Since the AssetFileHash is unchanged, if you've already cached the previous asset bundle, LoadFromCacheOrDownload does not download the new bundle, and you get errors such as "The referenced script on this Behaviour is missing!".
But you don't see this error if you haven't already cached the previous version, so it's easy to miss until final production & test.
nventimiglia
Nov 23, 2016 00:55
Behold, I have a workaround for this issue.
In my case I had an asset bundle with a scene, a scriptable object, and a few prefabs. The script references on the prefabs broke. The scene reference to the scriptable object was broke. I think the cause of this was a name refactor.
My solution was to duplicate my project assets (prefabs and scriptable objects) and then reference the duplicates. (e.g. MyPrefab --> BetterMyPrefab). This fixed my asset bundle.
Usmith
Nov 27, 2015 02:56
I forgot my Unity version is 5.2.2f1
Usmith
Nov 27, 2015 02:55
Is this really fixed? I have a exactly same issue like in this thread:
http://forum.unity3d.com/threads/error-fixing-reference-to-the-runtime-script-in-scene-file.325016/
I have a base AnimatorController that attached StateMachineBehaviour scripts in some of the states, and I have OverrideAnimatorControllers that override the base AnimatorController. The base AnimationController and OverrideAnimatorControllers are separated to different bundles, that means when i load the OverrideAnimatorControllers, i load it's dependency AnimationController first. I think this work flow shouldn't has problem, and it works almost, unless it involves the animation and baked GI things. By the animator, the first time i load the gameobject that has a OverrideAnimatorController, it seems all right, but the second time, this error appears and follows an error without any info but only error:(-1)
lermy3d
Aug 25, 2015 14:58
Great news! I already test this on 5.2.0f2 and is working, I also tested to bundle several scenes in one prefab and works! So i can now have a bundle with my scenes! Finally!
Great work Unity!
sawek1
Aug 24, 2015 10:51
In Unity 5.1.1 I had the same problem, but it was caused by changing any normal class in abstract class... For MonoDevelop everything was right, but Unity couldn't work with it.
watsonsong
Jun 29, 2015 13:20
I known what happend here. I attach a script to a prefab of a scene, and make assetbundle for them.
When I change the script namespace and load the asset from assetbundle, the reference from the script is missing. That correct because I am not rebuilding the assetbundle.
But when I rebuild the assetbundle, the assetbundle file updated and changed. The CRC in manifest file is changed too. But both the asset hash and type tree hash is not changed.
Because I am downloading the script using WWW.LoadFromCacheOrDownload, and using the assetbundle hash as the version, so the downloaing new assetbunlde is failing because the hash is not changed. And of course the script reference is still missing.
I need clear the cache to force redownload, and everything is OK. So I think unity engine should track the script class name or namespace change, and reforce the hash code update. And even the CRC is change, why the hash is not change, what the different between them?
watsonsong
Jun 24, 2015 13:23
It still not fixed in 5.1.1p1, again and again and again...
watsonsong
Jun 13, 2015 10:36
I ask this question:
http://forum.unity3d.com/threads/bug-the-new-assetbundle-in-5-x-can-not-keep-reference-to-script-when-it-change-name.327721/
But I can not seem the progress of this problem, and any way can communicate with the person met the same situation.
I really want to known how to resolve it, I am waiting more than one month.
Lermy KefSensei
Jun 04, 2015 19:11
Hello! I'm ussing Unity 5.1.0f3 and I still have this bug. Actually, I also have a missing reference in a prefab that has an sprite that is located in the resources folder of the projects, but the wierdest thing is that I have a background that reference to an image in the same folder and the background it does load!
Removing and setting the asset's reference and then building the bundle again, does Not solve the issue for me.
Thanks for any advice!