- Home /
Script running perfectly fine in preview mode, but not updating during the build
Hi All,
I have a script UFSMGui, that represents the HUD of the player. When I run it in preview mode, it runs perfectly fine. However, when I build the scene and try to run it, the HUD reflects a much older version of the same script. Any ideas on what could be causing this?
I have tried reimporting, refreshing, even changing the script repeatedly, and nothing works. The preview is absolutely perfect so its hard to determine where I'm going wrong. No errors in the debug log either.
Thanks.
Answer by JesusChristChangedMe · Dec 23, 2010 at 04:17 PM
I struggled with this same bug myself. I. Found the solution was to delete all older builds and their data. If you have numerous builds or previous ones, some reason it will mess up current builds. Just get rid of the previous applications and their data in your asset folder.
another reason for this is that every time you build it, you for some reason, don't rename it and it makes a copy of the data. and if by some reason you have the same exact name for both data folders, unity will pick the data folder (i'd guess the first one, but who knows, at random? in order?) but the best thing to do is only have your current build present. always delete previous builds (to avoid that problem and also to save memory on your comoputer.)
In other words, make sure you overwrite the application. So the data Is overwritten too.
Thanks for the answer, but I tried it and it did not work. Any other ideas?
is it giving you an error when you try to build it. about halfway through?
Your answer
![](https://koobas.hobune.stream/wayback/20220613092203im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Export objects to a .3DS file at runtime 1 Answer
Asset preview at runtime 0 Answers
Model building in Unity with primitives and prefabs - opinions desired. 2 Answers
Destroy the first instanced prefab while still being able to generate more prefab's later 1 Answer
Adjusting terrain texture tiling. 1 Answer