Introduction to the Preview Process and Common Error Handling
This section introduces the browser preview process.
The browser preview is essentially the editor opening an express server that opens the user's default browser to access the preview URL when the "Preview" button is clicked. the preview template has some simple logic written in it for loading the engine and initializing the scene, while the loading of user assets relies heavily on the generation of
settings.json contains the The current project's assets, scripts, and project settings are documented in
settings.json. The preview
settings.json is generated by calling the interface of the build extension, so if
settings.json is not generated properly, select Developers -> Open Build DevTools to see it.
Common Error Handling
When encountering a preview that does not display properly, first, open NetWork in DevTools to see if there are assets or scripts that failed to load at this time.
settings.json failed to load
Before looking for the cause of this issue, make sure there are no error messages in the editor before previewing.
Under normal circumstances,
settings.json load failure means
settings.json generation fails, there will be error messages in console. Most common is a script error, because when generating
settings.json, all scripts in the project are loaded in the build process. If any script contains illegal writing, an unexpected error will be thrown during the loading process and
settings.json will fail to be generated. For specific error message information, you can refer to the hint in the error message. Usually the error content here is the UUID of the asset. The corresponding UUID can be copied to the Assets panel to search and locate the script.
For more information about the specific generation process of
settings.json, please refer to the Introduction to the Build process and FAQ documentation. The preview
settings.json generation rules are basically the same as the generation rules with only debug mode checked, the difference is that the preview only sorts out asset information and does not package the assets.
Asset loading 404
Usually, this is caused by asset loss or import failure. Please use the missing asset UUID to search in the editor's assets panel. If no assets are found, usually the asset is lost. You need to modify the scene or other assets that use this lost asset. If assets are found, you can try to re-import.