At Runtime...
During your Unity scene initialization you can load the first TScene by calling TpChunkedSceneManager.
When the OnAfterTSceneChange callback is handled by your custom code you call the UpdateTickAsync method in TpZoneLayout which fills in the initial camera view with chunks of tiles using the Chunk Size that you’ve chosen.
Then, as the camera moves, your custom code continues to call the TpZoneLayout.UpdateTickAsync method and the chunks outside the camera view are deleted and chunks that will be within the camera view are added automatically.
The TpChunkedSceneManager MonoBehaviour component allows you to load TScenes by name, an index in the list of TScenes, or by the TScene’s GUID. Using the GUID is preferred for save files rather than using an index or name as it reduces the chance for errors that could occur if you change names or order of TScenes in the asset file used to record all that information.
A flexible system of SceneInitializers lets the ChunkedSceneManager automatically invoke code that can extract information from the loaded tiles (e.g., waypoints, spawners) when the TScene is loaded.
Callbacks invoked at several stages of the loading process are used to
- Indicate that the current TScene is about to be unloaded. All Tiles and Prefabs will be deleted.
- If you’ve spawned any Prefabs that aren’t parented to any of the Tilemaps, delete them.
- Indicate that a new TScene is about to be loaded.
- Indicate that the new TScene loading was completed so you can do any final initialization.
You can optionally enable a Tile Position Database (TPDB). If enabled, the TPDB keeps track of all positions occupied by tiles for specific Tilemaps; you specify which ones during your initialization.
Simple path-testing and ‘position occupied’ methods in TPDB can be used to avoid collider issues in many situations. This is illustrated in the demonstration program.