Skip to content

Commit 148801b

Browse files
v1.3.4 Improve Archive Command and update UnityFileSystemAPI (#62)
Adds new archive inspection subcommands, self-contained archive metadata parsing, JSON output support, and C# wrappers for recently added UnityFileSystemApi functions. New archive subcommands: info, header, blocks Improved archive list with offsets Archive command supports JSON output via -f Json. archive extract supports --filter option Self-contained archive metadata parsing Extracted all WebBundle-specific code from Archive.cs into a dedicated WebBundleHelper class. Update to UnityFileSystemApi C# wrappers Added P/Invoke declarations and public wrappers for 7 new native API functions (this is exposes TypeTree info that may be used in future PRs)
1 parent c883beb commit 148801b

22 files changed

Lines changed: 1580 additions & 123 deletions

Documentation/command-archive.md

Lines changed: 92 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,112 @@ The `archive` command provides utilities for working with Unity Archives (AssetB
66

77
| Sub-Command | Description |
88
|-------------|-------------|
9+
| [`info`](#info) | Display a high-level summary |
10+
| [`header`](#header) | Display archive header information |
11+
| [`blocks`](#blocks) | Display the data block list |
912
| [`list`](#list) | List contents of an archive |
1013
| [`extract`](#extract) | Extract contents of an archive |
1114

1215
---
1316

17+
## info
18+
19+
Displays a high-level summary of a Unity Archive file, including compression ratio, file counts, and data sizes.
20+
21+
### Quick Reference
22+
23+
```
24+
UnityDataTool archive info <archive-path> [options]
25+
```
26+
27+
| Option | Description | Default |
28+
|--------|-------------|---------|
29+
| `<archive-path>` | Path to the archive file | *(required)* |
30+
| `-f, --format <Text\|Json>` | Output format | `Text` |
31+
32+
### Example
33+
34+
```bash
35+
UnityDataTool archive info scenes.bundle
36+
UnityDataTool archive info scenes.bundle -f Json
37+
```
38+
39+
---
40+
41+
## header
42+
43+
Displays the header information of a Unity Archive file, including format version, Unity version, file size, metadata compression, and archive flags.
44+
45+
Very old versions of the Unity Archive format are not supported. But the files created by all currently supported Unity versions should be compatible (and it was tested with files as old as Unity 2017).
46+
47+
### Quick Reference
48+
49+
```
50+
UnityDataTool archive header <archive-path> [options]
51+
```
52+
53+
| Option | Description | Default |
54+
|--------|-------------|---------|
55+
| `<archive-path>` | Path to the archive file | *(required)* |
56+
| `-f, --format <Text\|Json>` | Output format | `Text` |
57+
58+
### Example
59+
60+
```bash
61+
UnityDataTool archive header scenes.bundle
62+
UnityDataTool archive header scenes.bundle -f Json
63+
```
64+
65+
---
66+
67+
## blocks
68+
69+
Displays the data block list of a Unity Archive file, showing the size, compression type, and file offset of each block.
70+
71+
Very old versions of the Unity Archive format are not supported.
72+
73+
### Quick Reference
74+
75+
```
76+
UnityDataTool archive blocks <archive-path> [options]
77+
```
78+
79+
| Option | Description | Default |
80+
|--------|-------------|---------|
81+
| `<archive-path>` | Path to the archive file | *(required)* |
82+
| `-f, --format <Text\|Json>` | Output format | `Text` |
83+
84+
### Example
85+
86+
```bash
87+
UnityDataTool archive blocks scenes.bundle
88+
UnityDataTool archive blocks scenes.bundle -f Json
89+
```
90+
91+
---
92+
1493
## list
1594

16-
Lists the SerializedFiles contained within an archive.
95+
Lists the contents of an archive, including the offset, size, and flags of each file.
96+
97+
Very old versions of the Unity Archive format are not supported.
1798

1899
### Quick Reference
19100

20101
```
21-
UnityDataTool archive list <archive-path>
102+
UnityDataTool archive list <archive-path> [options]
22103
```
23104

105+
| Option | Description | Default |
106+
|--------|-------------|---------|
107+
| `<archive-path>` | Path to the archive file | *(required)* |
108+
| `-f, --format <Text\|Json>` | Output format | `Text` |
109+
24110
### Example
25111

26112
```bash
27113
UnityDataTool archive list scenes.bundle
114+
UnityDataTool archive list scenes.bundle -f Json
28115
```
29116

30117
---
@@ -43,11 +130,13 @@ UnityDataTool archive extract <archive-path> [options]
43130
|--------|-------------|---------|
44131
| `<archive-path>` | Path to the archive file | *(required)* |
45132
| `-o, --output-path <path>` | Output directory | `archive` |
133+
| `--filter <text>` | Case-insensitive substring filter on file paths inside the archive | *(none — extract all)* |
46134

47135
### Example
48136

49137
```bash
50138
UnityDataTool archive extract scenes.bundle -o contents
139+
UnityDataTool archive extract scenes.bundle --filter sharedAssets
51140
```
52141

53142
**Output files:**
@@ -58,7 +147,7 @@ contents/BuildPlayer-Scene2.sharedAssets
58147
contents/BuildPlayer-Scene2
59148
```
60149

61-
> **Note:** The extracted files are binary SerializedFiles, not text. Use the [`dump`](command-dump.md) command to convert them to readable text format.
150+
> **Note:** The extracted files are in binary formats, not text. If they are SerializedFiles then use the [`dump`](command-dump.md) command to convert them to readable text format. See also the [`serialized-file`](command-serialized-file.md) command.
62151
63152
---
64153

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
This is an example of the format used for Player Data when compression is enabled.
2+
3+
It is a Unity Archive and can be examined with the "archive" command. It was created with Unity 2021.3.20f1.
4+
This was built without TypeTrees enabled, so the analyze command is not able to extract information.
5+
449 KB
Binary file not shown.

0 commit comments

Comments
 (0)