This SceneManifest package is a tool for organizing scenes into explicit groupings (e.g. world 3, level 2) that you can query at run time. It also retains information about scenes included in your build. This can be useful if you need to take action based on whether or not a level can be loaded. Included is an example scene and script to demonstrate various ways the SceneManifest can be used.
For Orion’s Forge, we needed to map a few bits of data to each level (e.g. which ‘world’ is this level a part of, and is it the first or last level in a sequence?). To do this, we added SceneClusters to a resource file we call the SceneManifest.¬†SceneClusters are just groupings of scenes (e.g. the desert world is comprised of many sub-levels in Mario). You COULD simply assume that levels progress one after another as ordered in the Build Settings Panel, ¬†but that’s error prone and difficult to read at a glance. The SceneManifest makes the boundaries between ‘zones’ concrete. ¬†This can be (useful / necessary) for presenting a level select UI, setting save points, etc.
Also: In past projects Tom and I wanted to have information about which scenes were included in our ad-hoc development builds. We’d often disable certain large levels to make deployment to mobile devices faster. Doing so, however, meant that level jumps might behave unexpectedly or crash. Ideally, we would have changed the level loading script to gracefully handle the non-existence of a scene and jump ahead in the game, or return to the main menu. With the Scene Manifest we can now do exactly this.
Feel free to contact us with questions or comments about this release.¬†We have no immediate plans to update the SceneManifest, but here are some features we’ve thought about adding:
- Take over the EditorBuildSettings panel. We’ve often found ourselves wanting a pre-build process step, and as of yet we have not found any Unity hooks for doing so (there are metadata tags for PostProcessScene and PostProcessBuild, but these don’t happen before a scene is compressed and cooked). One way to get around this would be to simply replace the build panel altogether with our own custom panel.
- Tagging. It would be nice to tag a level with descriptors (e.g. hard, or lots of spike enemies, etc). It’d also be nice for those ‘special’ scenes you almost always end up with, like the title screen or main menu. It might be possible to leverage the existing asset tagging system Unity offers.
- Drag and drop functionality! Or keyboard shortcuts.