Skip to content

Commit 3308843

Browse files
More documentation of the project structure in main README
1 parent df445a6 commit 3308843

1 file changed

Lines changed: 71 additions & 18 deletions

File tree

README.md

Lines changed: 71 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -37,19 +37,76 @@ New to Unity's data files or to UnityDataTool? These topics are a good place to
3737

3838
## Repository content
3939

40-
The repository contains the following items:
41-
* [UnityDataTool](Documentation/unitydatatool.md): a command-line tool providing access to the Analyzer, TextDumper and other class libraries.
42-
* [Analyzer](Documentation/analyzer.md): a class library that can be used to extract key information
43-
from Unity data files and output it into a SQLite database.
44-
* [TextDumper](Documentation/textdumper.md): a class library that can be used to dump SerializedFiles into
45-
a human-readable format (similar to binary2text).
46-
* [ReferenceFinder](Documentation/referencefinder.md): a class library that can be used to find
47-
reference chains from objects to other objects using a database created by the Analyzer
48-
* UnityFileSystem: source code and binaries of a .NET class library exposing the functionalities or the
49-
UnityFileSystemApi native library.
50-
* UnityFileSystem.Tests: test suite for the UnityFileSystem library.
51-
* UnityProjects: Unity projects used to generate some of the test data.
52-
* TestCommon: a helper library used by the test projects.
40+
The solution is organised in three layers. At the base are the libraries that read Unity's binary
41+
formats. On top of those sit the feature libraries that turn that raw data into something useful
42+
(a database, a text dump, a reference graph). And at the top is the command-line tool that exposes
43+
all of that functionality to users.
44+
45+
```mermaid
46+
flowchart TD
47+
CLI["<b>UnityDataTool</b><br/>command-line tool<br/>(+ archive / serialized-file commands)"]
48+
49+
Analyzer["<b>Analyzer</b><br/>SQLite database"]
50+
TextDumper["<b>TextDumper</b><br/>human-readable dump"]
51+
ReferenceFinder["<b>ReferenceFinder</b><br/>reference chains"]
52+
53+
UnityFileSystem["<b>UnityFileSystem</b><br/>C# wrapper +<br/>UnityFileSystemApi (native)"]
54+
UnityBinaryFormat["<b>UnityBinaryFormat</b><br/>C# parsers &amp; helpers<br/>for Archives / SerializedFiles"]
55+
UnityDataModels["<b>UnityDataModels</b><br/>schemas for build reporting file formats"]
56+
57+
CLI --> Analyzer
58+
CLI --> TextDumper
59+
CLI --> ReferenceFinder
60+
CLI --> UnityBinaryFormat
61+
CLI --> UnityFileSystem
62+
63+
Analyzer --> UnityFileSystem
64+
Analyzer --> UnityBinaryFormat
65+
Analyzer --> UnityDataModels
66+
TextDumper --> UnityFileSystem
67+
TextDumper --> UnityBinaryFormat
68+
UnityBinaryFormat --> UnityFileSystem
69+
70+
ReferenceFinder -. "reads the SQLite database" .-> Analyzer
71+
```
72+
73+
**Command-line tool**
74+
* [UnityDataTool](Documentation/unitydatatool.md): the command-line tool. It wires the feature
75+
libraries together and exposes them as commands (`analyze`, `dump`, `find-refs`, and more), so most
76+
users only ever interact with this executable. It also directly contains the implementation of the
77+
`archive` and `serialized-file` commands — critical features for working with the file formats,
78+
built mostly on top of UnityBinaryFormat.
79+
80+
**Feature libraries**
81+
* [Analyzer](Documentation/analyzer.md): extracts key information from Unity data files into a SQLite
82+
database for detailed analysis. It also parses Addressables build reports.
83+
* [TextDumper](Documentation/textdumper.md): dumps SerializedFiles into a human-readable format
84+
(similar to Unity's binary2text).
85+
* [ReferenceFinder](Documentation/referencefinder.md): finds reference chains from one object to
86+
another by querying a database produced by the Analyzer (a data dependency rather than a code one).
87+
88+
**Base libraries**
89+
* UnityFileSystem: a .NET class library, with source and binaries, that wraps the native
90+
`UnityFileSystemApi` to mount Unity Archives and read SerializedFiles.
91+
* UnityBinaryFormat: C# parsers and helpers for reading data out of Unity Archives and SerializedFiles.
92+
* UnityDataModels: shared C# models for the reading JSON format files produced by the build (Addressables BuildLayout.json, Content Directory ContentLayout.json).
93+
94+
## Purpose of UnityFileSystemApi
95+
96+
UnityFileSystemApi is compiled from the Unity source code and exposes the core functionality to open and read the Unity Archive and Serialized File formats, exposed as a flexible, performant library. It exposes ability to navigates the TypeTrees inside a SerializedFile so objects can be read generically, without hardcoded type knowledge.
97+
98+
It enables custom tools for binary2text-like output and efficient SQLite database generation.
99+
100+
### Tests and test data
101+
102+
The automated tests are not shown in the diagram above. Each library has its own test project, and the
103+
shared test data doubles as convenient sample content for ad hoc use of the tool.
104+
105+
* TestCommon: a helper library whose `Data/` folder holds small reference files extracted from real
106+
Unity builds (Player, AssetBundles, content directory etc). These back the automated tests and are also handy for trying out the tool by hand.
107+
* Analyzer.Tests, UnityDataTool.Tests, UnityFileSystem.Tests: the per-library test suites.
108+
* UnityProjects: two Unity projects (`Baseline` and `LeadingEdge`) used to regenerate some of the test
109+
data as Unity evolves.
53110

54111
## Downloads
55112

@@ -63,7 +120,7 @@ Refer to the [commit history](https://github.com/Unity-Technologies/UnityDataToo
63120

64121
## Getting UnityFileSystemApi
65122

66-
UnityDataTool uses the native `UnityFileSystemApi` library to read Unity Archives and SerializedFiles. **Normally you don't need to do anything with this library.** The repository already includes a recent Windows, Mac, and Linux copy in the [`UnityFileSystem/`](https://github.com/Unity-Technologies/UnityDataTools/tree/main/UnityFileSystem) directory, and using that bundled copy is the recommended way to run the tool.
123+
UnityDataTool uses the pre-compiled `UnityFileSystemApi` library to read Unity Archives and SerializedFiles. **Normally you don't need to do anything with this library.** The repository already includes a recent Windows, Mac, and Linux copy in the [`UnityFileSystem/`](https://github.com/Unity-Technologies/UnityDataTools/tree/main/UnityFileSystem) directory, and using that bundled copy is the recommended way to run the tool.
67124

68125
The library is backward compatible but not forward compatible: a given version can read content from the same or older Unity versions, but may be unable to read content produced by a newer Unity Editor than the library itself. The bundled copy is updated periodically as Unity evolves, so in practice it can read content from just about any Unity version.
69126

@@ -84,10 +141,6 @@ On Windows, the executable is written to `UnityDataTool\bin\Release\net9.0`. Add
84141

85142
See the [command-line tool documentation](./Documentation/unitydatatool.md) for usage instructions.
86143

87-
## Purpose of UnityFileSystemApi
88-
89-
UnityFileSystemApi exposes the core functionality of WebExtract and binary2text to open and read the Unity Archive and Serialized File formats, exposed as a flexible, performant library. It enables custom tools for binary2text-like output and efficient SQLite database generation.
90-
91144
## Origins
92145

93146
This tool is the evolution of the [AssetBundle Analyzer](https://github.com/faelenor/asset-bundle-analyzer)

0 commit comments

Comments
 (0)