Skip to content

[#97] Add Unity scenes to LeadingEdge reference builds#98

Merged
SkowronskiAndrew merged 4 commits into
mainfrom
issue97-leadingedge-scenes
Jul 14, 2026
Merged

[#97] Add Unity scenes to LeadingEdge reference builds#98
SkowronskiAndrew merged 4 commits into
mainfrom
issue97-leadingedge-scenes

Conversation

@SkowronskiAndrew

Copy link
Copy Markdown
Collaborator

Summary

Fixes #97.

Adds two small Unity scenes to the LeadingEdge test project so the reference builds cover scene content. Scenes are a special case in every build pipeline, and the initial test project had none in its output. Both scenes show the shared GreenStatic.png texture through a SpriteRenderer (with distinct GameObject names so their content differs), and a new SceneList ScriptableObject references them by name through a serialized dictionary of LoadableSceneId, which is what pulls them into the Content Directory build.

The regenerated Content Directory output now demonstrates the scene conventions worth documenting: each scene becomes exactly one Content File (with the scene's GUID as its stable .cfid identity), the assets a scene references land in their own Content Files, and LoadableSceneId references are recorded in the manifest (LoadableSceneDependencies) rather than the external-reference table.

Changes

LeadingEdge project

  • GenerateAssets.cs generates the two scenes (imports the texture as a Sprite) and the SceneList.asset, which is added to ContentDirectoryRoot.asset's direct references.
  • BuildAssetBundles.cs adds a scenes bundle containing both scenes (AssetBundles require scenes and assets in separate bundles).
  • Project AGENTS.md describes the new scene scenario; the tracked editor version moved to 6000.6.0b5.

Reference data (TestCommon/Data/LeadingEdgeBuilds)

  • AssetBundle build regenerated: new scenes bundle; existing bundles are unchanged.
  • Content Directory build and its build report (including ContentLayout.json, now listing LoadableSceneIds) regenerated. New Content Files for the scenes, the Sprite/Texture2D split of GreenStatic.png, unity_builtin_extra, and the SceneList asset.

Tests

  • New SceneBundleContentTests: verifies the scenes bundle contains one SerializedFile per scene (plus sharedAssets), that scene files hold the expected objects via the serialized-file command, and that the shared texture is included exactly once.
  • Analyze_FullAssetBundleSet_ResolvesCrossBundleReferences now excludes references into Unity's built-in resource files (unity_builtin_extra, unity default resources), which the scene bundle introduces and which always dangle.

Documentation

  • contentdirectory-format.md gains a Scenes section: how scenes enter a build through LoadableSceneId, the one-Content-File-per-scene rule (contrasted with Player builds' sharedassets split), sequential object IDs in scene files, and worked ContentLayout.json examples from the reference build. Schema details stay on the contentlayout.md page.
  • The "References between Content Files" walkthrough is updated to the regenerated build's indexes and hashes (the resolution steps are unchanged).

Testing

dotnet test — full suite green (730 passed, 10 skipped). New scene coverage as described above; manually verified the scenes bundle and the scene/SceneList Content Files with archive list/extract, serialized-file objectlist, and dump, and cross-checked the documented examples against the regenerated ContentLayout.json.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds small Unity scenes and a SceneList ScriptableObject to the LeadingEdge fixture, updates build scripts to bundle scenes correctly, and introduces tests/docs to validate scene content in produced build outputs.

Changes:

  • Generate two scenes sharing a texture and add a SceneList asset that references them via LoadableSceneId.
  • Update AssetBundle build script to output a dedicated scenes bundle and refresh checked-in reference build artifacts.
  • Add NUnit coverage to sanity-check scene bundle contents and adjust dangling-ref expectations for built-in resources.

Reviewed changes

Copilot reviewed 28 out of 43 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
UnityProjects/LeadingEdge/Assets/Textures/GreenStatic.png.meta Adds import settings for the shared sprite texture used by generated scenes.
UnityProjects/LeadingEdge/Assets/Textures.meta Adds metadata for the new Textures folder.
UnityProjects/LeadingEdge/Assets/Scripts/SceneList.cs.meta Adds meta for the new SceneList ScriptableObject script.
UnityProjects/LeadingEdge/Assets/Scripts/SceneList.cs Introduces a ScriptableObject that maps scene names to LoadableSceneIds.
UnityProjects/LeadingEdge/Assets/ScriptableObjects/SceneList.asset.meta Adds meta for the generated SceneList asset.
UnityProjects/LeadingEdge/Assets/ScriptableObjects/SceneList.asset Adds a generated asset mapping Scene1/Scene2 to scene GUIDs.
UnityProjects/LeadingEdge/Assets/ScriptableObjects/ContentDirectoryRoot.asset Adds SceneList as an additional root reference for content directory builds.
UnityProjects/LeadingEdge/Assets/Scenes/Scene2.unity.meta Adds meta for the second generated scene.
UnityProjects/LeadingEdge/Assets/Scenes/Scene2.unity Adds the second generated scene referencing the shared sprite.
UnityProjects/LeadingEdge/Assets/Scenes/Scene1.unity.meta Adds meta for the first generated scene.
UnityProjects/LeadingEdge/Assets/Scenes/Scene1.unity Adds the first generated scene referencing the shared sprite.
UnityProjects/LeadingEdge/Assets/Editor/GenerateAssets.cs Extends asset generation to create scenes and a SceneList asset.
UnityProjects/LeadingEdge/Assets/Editor/BuildAssetBundles.cs Adds a dedicated scene bundle build alongside existing per-asset bundles.
UnityProjects/LeadingEdge/AGENTS.md Updates project description and documents newly added scenes.
UnityDataTool.Tests/SceneBundleContentTests.cs Adds tests validating the scenes AssetBundle structure/content and texture deduplication.
UnityDataTool.Tests/AnalyzeDanglingRefsTests.cs Updates expectations to allow built-in resource dangling references.
TestCommon/Data/LeadingEdgeBuilds/ContentDirectory/baff06b928d147276f2245dd3b19216a.json Updates the checked-in content directory manifest to include scenes and new dependencies.
TestCommon/Data/LeadingEdgeBuilds/ContentDirectory/BuildManifestHash.txt Updates the manifest hash pointer to the new content directory manifest.
TestCommon/Data/LeadingEdgeBuilds/ContentDirectory/15d5df98d98434e67e06716cfabfad1b.json Removes the prior content directory manifest.
TestCommon/Data/LeadingEdgeBuilds/BuildReport-ContentDirectory/ScriptsOnlyCache.yaml Updates build report cache to include SceneList / LoadableSceneId types.
TestCommon/Data/LeadingEdgeBuilds/BuildReport-ContentDirectory/ContentSizeSummary.txt Updates build size summary reflecting inclusion of scenes/texture/built-ins.
TestCommon/Data/LeadingEdgeBuilds/BuildReport-ContentDirectory/ContentLayout.json Updates ContentLayout.json with scene entries and new dependency structure.
TestCommon/Data/LeadingEdgeBuilds/BuildReport-ContentDirectory/BuildReportSummary.json Updates build report summary fields for the new build output.
TestCommon/Data/LeadingEdgeBuilds/BuildReport-ContentDirectory/BuildLog.jsonl Updates build log to reflect the new build steps/content.
TestCommon/Data/LeadingEdgeBuilds/BuildReport-ContentDirectory/BuildContentTEP.json Updates TEP trace reflecting the new build content and durations.
TestCommon/Data/LeadingEdgeBuilds/AssetBundles/scenes.manifest Adds manifest for the new scenes AssetBundle.
TestCommon/Data/LeadingEdgeBuilds/AssetBundles/AssetBundles.manifest Updates root AssetBundles manifest to include scenes and new Unity version.
Documentation/contentdirectory-format.md Documents how scenes appear in content directory builds and updates examples.
Comments suppressed due to low confidence (3)

UnityProjects/LeadingEdge/Assets/Editor/GenerateAssets.cs:1

  • GenerateScenes() creates new scenes using NewSceneMode.Single, which closes currently open scenes. When run from the menu, this can prompt users to save/lose work and can disrupt editor state during automation. Consider creating scenes in Additive mode (and closing them after saving) or capturing/restoring the previously open scenes/active scene after generation.
    UnityProjects/LeadingEdge/Assets/Scripts/SceneList.cs:1
  • This is a public mutable field on a ScriptableObject asset. That makes it easy for runtime code to accidentally modify the asset's serialized state (in-editor) or the in-memory data. A more robust API is to keep the backing field private [SerializeField] and expose a read-only view (e.g., via a getter returning IReadOnlyDictionary<string, LoadableSceneId>), so callers can query without mutating.
    UnityProjects/LeadingEdge/Assets/Scripts/SceneList.cs.meta:1
  • This .meta file looks incomplete for a C# script asset (it typically includes a MonoImporter: section with default settings). Unity will likely regenerate it on import, creating noisy diffs and potential merge churn. Re-export/regenerate the meta from Unity so it matches the standard script meta format (while preserving the GUID).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread UnityDataTool.Tests/SceneBundleContentTests.cs
@SkowronskiAndrew SkowronskiAndrew marked this pull request as ready for review July 14, 2026 21:55
@SkowronskiAndrew SkowronskiAndrew merged commit ea63707 into main Jul 14, 2026
5 checks passed
@SkowronskiAndrew SkowronskiAndrew deleted the issue97-leadingedge-scenes branch July 14, 2026 21:57
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.

Testing: Add Unity scenes to reference builds in LeadingEdgeBuilds

2 participants