I recently exported my UI made with the UI Toolkit into another project. Since then I get spamed with MissingAssetReference warnings and i dont know how/where to resolve them.
Invalid value for font MissingAssetReference
UnityEngine.UIElements.VisualTreeStyleUpdaterTraversal:TraverseRecursive (UnityEngine.UIElements.VisualElement,int) …
Invalid value for font MissingAssetReference
UnityEngine.UIElements.UIElementsRuntimeUtilityNative:UpdateRuntimePanels ()
If you move this from one project to another then I guess the guid has become invalid, so you need to replace the reference with the new guid. Maybe you can get away with only the asset file, I have never tried. You can recreate the font with right click Create > Text > Font Asset.
It was a dependency of the UI toolkit package, this has changed as the code of both is now built-in the editor. Glad the issue is not with the upgrade process (because there was as few issue with it), the only thing remaining is to look for these font assets in your project. I think the reference is set when the uxml is imported and I don’t know if there is a reimport triggered when missing assets are added to the project: after moving the font files to the new project, you may need to right-click on the UXML and reimport the assets.
So, I took out all font definitions from my UI Document and I still get those warnings constantly when resizing the game view or scrolling inside the UI Builder.
I Tried reimporting the UI Document and exchaning all font definition with a newly created Font with no effect.
I have two UI Documents imported, the one we are talking about and another which does not throw any warnings when enabled in the scene. When I was looking at both UI Documents I was looking for differences and the only I could find where at the top level but I cant make any sense out of them.
Some error messages are only displayed when importing the uxml and uss assets. You can try reimporting them and have a look at the console, maybe that can help.
Otherwise, you can try removing the guid/fileinfo from the url link (“?fileID=11400000&guid=24be2277e1f5cbe4f90438cd2704c897&type=2”)
When copying files from one project to another, it’s important to carry the .meta files around so guids stay the same.
If that doesn’t help, another thing I could see if that if some other built-in asset was copied from one project to the other, maybe that could cause some issues. You can try deleting the default runtime stylesheet and recreate a new PanelSettings asset. When no theme is present, the editor will export a new one.
If none of that helps, please file a bug and we’ll have a look.
Ok, I removed ALL font references from all inline styles and uss documents and now the warnings are gone, yay!
Now i can start settings fonts on a more global scrope (not inline).
I will be certainly more careful when exporting my UI into another project, beeing mindful to take all relevant files with me if that was the mistake!