@@ -52,7 +52,7 @@ runtime.
5252
5353Every build artifact is named by the hash of its own content:
5454
55- - ** Content Files** use the ` .cf ` extension (for example ` a77f98db89b6aa1aeaaad01d857e5115 .cf` ).
55+ - ** Content Files** use the ` .cf ` extension (for example ` c0152db4dd710be51b2decb997325f34 .cf` ).
5656- ** ` .resS ` ** files hold streamed texture and mesh data.
5757- ** ` .resource ` ** files hold audio and video data.
5858
@@ -73,7 +73,7 @@ are present both for loose files and for entries packed inside an archive.
7373### The build manifest
7474
7575The build manifest is a JSON file, also named by its content hash (for example
76- ` 15d5df98d98434e67e06716cfabfad1b .json` ). It records everything needed to load the content: the list of
76+ ` baff06b928d147276f2245dd3b19216a .json` ). It records everything needed to load the content: the list of
7777Content Files, their dependencies, and the loadable objects and scenes. Its schema is internal and may
7878change substantially, so this page does not document it. Instead, use
7979[ ` ContentLayout.json ` ] ( contentlayout.md ) , which presents the same information (plus source-asset
@@ -106,7 +106,7 @@ many files contain just a single Unity object (a Material, Shader, Texture, Audi
106106few grouping rules shape the result:
107107
108108- ** Scenes and Prefabs** store their whole GameObject/Component hierarchy together in a single Content
109- File, just as they are represented in the Editor.
109+ File, just as they are represented in the Editor (see [ Scenes ] ( #scenes ) below) .
110110- ** Assets with sub-assets** are split across multiple Content Files. For example an FBX is separated
111111 so that the component hierarchy and the meshes land in different files.
112112- ** Scripts** are grouped: the ` MonoScript ` objects for several source scripts can share one Content
@@ -116,10 +116,84 @@ few grouping rules shape the result:
116116 to break a cycle is to convert one of the references into a ` Loadable ` (an on-demand reference)
117117 instead of a direct reference.
118118
119- Built-in resources are handled specially. The manifest carries an entry for ` unity default resources `
120- flagged as built-in (with no content hash); references to it resolve through the runtime's built-in
121- resource mechanism and the ` PersistentManager ` , rather than through the ` ContentLoadManager ` that
122- manages Content Files.
119+ Unity's two built-in resource files are handled in different ways:
120+
121+ - ** ` unity default resources ` ** is referenced but not included in the build, because those resources
122+ are always present in the Player that loads the content directory. The manifest carries an entry
123+ for it flagged as built-in (with no content hash); references to it resolve through the runtime's
124+ built-in resource mechanism and the ` PersistentManager ` , rather than through the
125+ ` ContentLoadManager ` that manages Content Files.
126+ - ** ` Resources/unity_builtin_extra ` ** gets no such special treatment: any referenced objects from it
127+ (for example the default sprite material and its shader) are included directly in the content
128+ directory output, in a Content File named by its content hash just like any other file in the
129+ build. This is because the ` unity_builtin_extra ` file in a Player is generated per build and
130+ contains only the project's "Always Included Shaders" — copying the referenced objects into the
131+ content directory makes it independent of what a particular Player build happens to contain.
132+
133+ ## Scenes
134+
135+ Content directory builds can include Unity Scenes. The build parameters only accept ScriptableObject
136+ assets as roots, so a scene enters the build by being referenced through a ` LoadableSceneId ` field (a
137+ small serializable struct identifying the scene) on an asset reachable from the roots. Every scene
138+ referenced this way is added to the output, along with the assets the scene itself references. At
139+ runtime, such a scene is loaded with ` SceneManager.LoadSceneAsync(LoadableSceneId) ` once the content
140+ directory is registered.
141+
142+ Each scene produces exactly one Content File, containing only the scene's own GameObject/Component
143+ hierarchy and scene settings objects. The assets the scene references (textures, materials, and so
144+ on) are not packed with it — they land in their own Content Files following the normal
145+ [ granularity rules] ( #build-layout-granularity ) , and the scene's file reaches them through the
146+ manifest dependency list. This differs from Player builds, where each scene comes with companion
147+ ` sharedassets ` files holding its assets. Scene Content Files also differ in their object IDs: the
148+ scene's objects get small sequential IDs (1, 2, 3, ...), rather than the 64-bit hash-based IDs used
149+ in other Content Files.
150+
151+ In ` ContentLayout.json ` (schema details on the [ ContentLayout.json] ( contentlayout.md ) page), the
152+ top-level ` LoadableSceneIds ` array lists each scene with its source path and the Content File that
153+ holds it. From the reference build in ` TestCommon/Data/LeadingEdgeBuilds ` , which includes two small
154+ scenes:
155+
156+ ``` json
157+ "LoadableSceneIds" : [
158+ { "GUID" : " 590cfeb4e0ff90f4e92f9e1262bcfe6f" , "Path" : " Assets/Scenes/Scene2.unity" , "SerializedFile" : 6 },
159+ { "GUID" : " 162c015549f8733449ac70ae78ad3aa5" , "Path" : " Assets/Scenes/Scene1.unity" , "SerializedFile" : 2 }
160+ ]
161+ ```
162+
163+ The scene's own ` SerializedFiles ` entry names the scene as its single source asset, and its symbolic
164+ ` ID ` is derived from the scene's GUID:
165+
166+ ``` json
167+ {
168+ "Index" : 2 ,
169+ "ID" : " 162c015549f8733449ac70ae78ad3aa5.cfid" ,
170+ "SourceAssets" : [ " Assets/Scenes/Scene1.unity" ],
171+ "SerializedFileDependencies" : [ 0 , 1 , 9 ],
172+ "ContentHash" : " c271b85494f5e4cc35c4ec4a776324af"
173+ }
174+ ```
175+
176+ So this scene lives in ` c271b85494f5e4cc35c4ec4a776324af.cf ` , and depends on three other files: the
177+ built-in ` unity default resources ` entry, the Content File built from ` Resources/unity_builtin_extra `
178+ (the default sprite material), and the file holding the Sprite it shows.
179+
180+ A ` LoadableSceneId ` reference is an on-demand reference, like a ` Loadable ` : loading the referencing
181+ file does not load the scene. The file holding the reference records the scene by path in its
182+ ` LoadableSceneDependencies ` , not in ` SerializedFileDependencies ` , and nothing appears in its
183+ external-reference table — the serialized ` LoadableSceneId ` field itself only holds the scene's
184+ GUID. The reference build's ` SceneList ` asset, a ScriptableObject with a dictionary of
185+ ` LoadableSceneId ` values, shows this:
186+
187+ ``` json
188+ {
189+ "Index" : 7 ,
190+ "ID" : " 70a210050f71a924aa83be7146547111.cfid" ,
191+ "SourceAssets" : [ " Assets/ScriptableObjects/SceneList.asset" ],
192+ "SerializedFileDependencies" : [ 8 ],
193+ "LoadableSceneDependencies" : [ " Assets/Scenes/Scene2.unity" , " Assets/Scenes/Scene1.unity" ],
194+ "ContentHash" : " 8ad4924ac5e264fde63d8e95a0dab8ab"
195+ }
196+ ```
123197
124198## Build history
125199
@@ -157,26 +231,27 @@ ordered list of the files it depends on:
157231
158232``` json
159233{
160- "Index" : 3 ,
234+ "Index" : 5 ,
161235 "ID" : " 52b43dad178849b42ac753005736e7bb.cfid" ,
162236 "SourceAssets" : [ " Assets/ScriptableObjects/ContentDirectoryRoot.asset" ],
163- "SerializedFileDependencies" : [ 4 , 2 , 6 , 7 ],
164- "ContentHash" : " a77f98db89b6aa1aeaaad01d857e5115 "
237+ "SerializedFileDependencies" : [ 8 , 4 , 11 , 13 , 7 ],
238+ "ContentHash" : " c0152db4dd710be51b2decb997325f34 "
165239}
166240```
167241
168- The ` ContentHash ` tells us this asset lives in ` a77f98db89b6aa1aeaaad01d857e5115 .cf` . Dumping that file
242+ The ` ContentHash ` tells us this asset lives in ` c0152db4dd710be51b2decb997325f34 .cf` . Dumping that file
169243shows the object's references and the file's external-reference table:
170244
171245```
172- UnityDataTool dump --stdout a77f98db89b6aa1aeaaad01d857e5115 .cf
246+ UnityDataTool dump --stdout c0152db4dd710be51b2decb997325f34 .cf
173247```
174248```
175249External References
176250path(1): "a2a42d71dddef12e8889849faf59bdd7.cfid" GUID: 00000000000000000000000000000000 Type: 0
177251path(2): "4038ff673d390134d924b57fcbed0432.cfid" GUID: 00000000000000000000000000000000 Type: 0
178252path(3): "21679be819d6e9146a63bb02a7e51f2f.cfid" GUID: 00000000000000000000000000000000 Type: 0
179253path(4): "78532141fd7679a458405eb16bdb75fd.cfid" GUID: 00000000000000000000000000000000 Type: 0
254+ path(5): "70a210050f71a924aa83be7146547111.cfid" GUID: 00000000000000000000000000000000 Type: 0
180255
181256ID: -775554941117088049 (ClassID: 114) MonoBehaviour
182257 ...
@@ -196,29 +271,29 @@ through the build. A key goal of the content directory design is to reduce the a
196271
197272Because of that, the content of the external table is effectively ignored by the loading system for
198273Content File references. What counts is the ordered dependency list in the manifest. The
199- ` "SerializedFileDependencies": [4, 2, 6 , 7] ` array corresponds, in exact size and order, to the four
200- entries of the external table.
274+ ` "SerializedFileDependencies": [8, 4, 11, 13 , 7] ` array corresponds, in exact size and order, to the
275+ five entries of the external table.
201276
202277So resolving the reference to ` SingleAudioClipLoadableReference ` above:
203278
2042791 . The ` PPtr ` has ` m_FileID ` 3. A non-zero ` m_FileID ` is a 1-based index into the external table (0
205280 would mean "this same file").
206- 2 . Index 3 maps to the 3rd entry of ` SerializedFileDependencies ` , which is ` 6 ` .
207- 3 . ` ContentLayout.json ` entry with ` "Index": 6 ` is ` SingleAudioClipLoadableReference.asset ` , whose
281+ 2 . Index 3 maps to the 3rd entry of ` SerializedFileDependencies ` , which is ` 11 ` .
282+ 3 . ` ContentLayout.json ` entry with ` "Index": 11 ` is ` SingleAudioClipLoadableReference.asset ` , whose
208283 ` ContentHash ` is ` 5c43454a3823f172a2a326410a36ba6b ` .
2092844 . The referenced file is therefore ` 5c43454a3823f172a2a326410a36ba6b.cf ` .
210285
211- The full mapping for this file, showing how each ` m_FileID ` in the external table resolves through the
212- dependency list ` [4, 2, 6 , 7] ` to a content-hash filename:
286+ A partial mapping for this file, showing how ` m_FileID ` values in the external table resolve through
287+ the dependency list ` [8, 4, 11, 13 , 7] ` to a content-hash filename:
213288
214289``` mermaid
215290flowchart TD
216- Root["<b>ContentDirectoryRoot</b><br/>cfid 52b43dad…<br/>file a77f98db ….cf<br/>deps [4, 2, 6 , 7]"]
217- Loadable["<b>LoadableAudioClipReference</b><br/>Index 2 · cfid 4038ff67…<br/>file bfcf18a2….cf"]
218- Single["<b>SingleAudioClipLoadableReference</b><br/>Index 6 · cfid 21679be8…<br/>file 5c43454a….cf"]
291+ Root["<b>ContentDirectoryRoot</b><br/>cfid 52b43dad…<br/>file c0152db4 ….cf<br/>deps [8, 4, 11, 13 , 7]"]
292+ Loadable["<b>LoadableAudioClipReference</b><br/>Index 4 · cfid 4038ff67…<br/>file bfcf18a2….cf"]
293+ Single["<b>SingleAudioClipLoadableReference</b><br/>Index 11 · cfid 21679be8…<br/>file 5c43454a….cf"]
219294
220- Root -->|"m_FileID 2 → dep 2 → Index 2 "| Loadable
221- Root -->|"m_FileID 3 → dep 6 → Index 6 "| Single
295+ Root -->|"m_FileID 2 → dep 4 → Index 4 "| Loadable
296+ Root -->|"m_FileID 3 → dep 11 → Index 11 "| Single
222297```
223298
224299> [ !NOTE]
0 commit comments