Skip to content

Conversation

@SkowronskiAndrew
Copy link
Collaborator

@SkowronskiAndrew SkowronskiAndrew commented Sep 26, 2025

Modest improvement in Error reporting and Archive handling

Explicitly check if a file is a Unity Archive rather than trying to mount every file just in case it turns out to be an archive.

Unity Archives have a distinctive signature string at the start so we can pre-triage which files are actually Unity Archives.
The expected values were confirmed by studying the Unity parsing code and debugging the load of some files in the editor.

Note: This is only a modest improvement because we still don't have some mechanism to predict if a file is a Unity Serialized File without attempting to load it and then failing. So when analyzing the output of a player build many files will still be reported as errors just because they are not actually containing built content.

Logging Improvements

  1. Report number of successful, failed and ignored files at the end.
    Previously it was hard to tell if errors were shown whether anything actually had been analyzed.

  2. On error move console back to the start of the line, so that errors are not printed at a random indent.

  3. Remove the noisy stack trace when there is an exception thrown during file processing.

Testing done

Running against AssetBundle and a Player build. This includes a very large directory of assetbundles from a customer that hits a lot of errors.

Also testing piping the output into a text file to make sure the logging is decent, e.g.

UnityDataTool analyze .  -o ..\out5.db -p "*.asset" -v  2>&1> ..\out.txt

Check for Archives rather than trying to mount every file just in case it turns out to be an archive.
Unity Archives have a distinctive signature string at the start so we can pre-triage which files are actually Unity Archives.
The expected values were confirmed by studying the Unity parsing code and debugging the load of some files in the editor.

Output improvement - when erasing progress message move back to the start of the line so that errors are not printed at a random indent.

This is only a modest improvement because we still don't have some mechanism to predict if a file is a Unity Serialized File without attempting to load it and then failing.
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR improves error handling and logging in the Unity data analysis tool by implementing pre-filtering of Unity Archive files and enhancing progress reporting. The changes make the analysis process more efficient and provide better feedback to users.

  • Pre-checks files for Unity Archive signatures before attempting to mount them as archives
  • Adds comprehensive logging with success/failure/ignored file counts and verbose mode improvements
  • Improves error message formatting by moving console cursor to line start

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Previously it was hard to tell if errors were shown whether anything actually had been analyzed.
Partial imports are normal until we find a way to reliably detect serialized files.
@SkowronskiAndrew SkowronskiAndrew force-pushed the AnalyzeErrorHandling branch 2 times, most recently from 512d93f to 746c11e Compare September 26, 2025 20:16
Mention errors that migth be visible (based on testing a folder with AssetBundles from different builds all being mixed together)
@SkowronskiAndrew
Copy link
Collaborator Author

Note- i tried for a while to see if i could support more than one build in analyze, e.g. if you have the output of two runs of an Addressables or AssetBundle build in sub-directories side by side.

A "work in progress" attempt is at 2d116a8 but i don't know if that approach is on the right track.

@SkowronskiAndrew SkowronskiAndrew merged commit fbb0f72 into main Sep 30, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants