0
Working on Fix

Can't build project: "A tree couldn't be loaded because the prefab is missing"

hoodust 3 weeks ago updated 2 weeks ago 3

A bug occurs that prevents builds from completing:

A tree couldn't be loaded because the prefab is missing.
UnityEditor.AssetDatabase:LoadAllAssetsAtPath(String)
Ludiq.OdinSerializer.Editor.AOTSupportScanner:ScanAsset(String, Boolean) (at C:/Users/lazlo/Projects/LudiqOdinSerializer/OdinSerializer/Unity Integration/AOTSupportScanner.cs:393)
Ludiq.OdinSerializer.Editor.AOTSupportScanner:ScanScenes(String[], Boolean, Boolean) (at C:/Users/lazlo/Projects/LudiqOdinSerializer/OdinSerializer/Unity Integration/AOTSupportScanner.cs:361)
Ludiq.OdinSerializer.Editor.AOTSupportScanner:ScanBuildScenes(Boolean, Boolean) (at C:/Users/lazlo/Projects/LudiqOdinSerializer/OdinSerializer/Unity Integration/AOTSupportScanner.cs:206)
Ludiq.OdinSerializer.Editor.AOTSupportUtilities:ScanProjectForSerializedTypes(List`1&, Boolean, Boolean, Boolean, Boolean, List`1) (at C:/Users/lazlo/Projects/LudiqOdinSerializer/OdinSerializer/Unity Integration/AOTSupportUtilities.cs:53)
Ludiq.OdinSerializer.Utilities.Editor.OdinBuildAutomation:OnPreprocessBuild() (at Assets/Ludiq/Ludiq.PeekCore/Runtime/Dependencies/OdinSerializer/OdinBuildAutomation.cs:77)
Ludiq.OdinSerializer.Utilities.Editor.OdinPreBuildAutomation:OnPreprocessBuild(BuildReport) (at Assets/Ludiq/Ludiq.PeekCore/Runtime/Dependencies/OdinSerializer/OdinBuildAutomation.cs:113)
UnityEditor.BuildPlayerWindow:BuildPlayerAndRun()

This bug goes away if I remove Peek, and comes back when I import Peek.

Unity Version:
2019.3.0f6
Peek Version:
1.1.7
Working on Fix

Hi hoodust,

Sorry you're experiencing this issue and thanks for the report.

From the error message and a quick Google search, it seems like you may have a terrain that has a tree with a missing prefab in your assets.

The Unity Answers posts suggests:

If you get this issue you just select each of the terrains and when you see that there is a missing tree in there you edit and then remove it. The thread is here: https://forum.unity3d.com/threads/strange-tree-error.18353/

I'll ping the Odin people about error recovery in that case -- a failure to load an asset should not result in a failed build, IMO.

Thanks. I never used Odin's serializer before and was "sure" I didn't have any "missing tree prefab" but I eventually googled that same page you linked and found I actually DID have a terrain hidden in an example folder in my project, and fixed it. Agree it shouldn't prevent a build though. Appreciate it!

Related to this (I think)... I still get serializing errors (different but similar to the above) sometimes when I delete certain files/scripts/assets, which forces me to delete the files in Ludiq Generated/Persistent/ProjectSettings.

EDIT: actually this probably more aligns to someone else's bug report "Skipping serialization..." but these two might still be related to that root cause. Thanks!