Skip to main content
←API Reference ←NianticSpatial.NSDK.AR.Subsystems ←LocationMeshManager

ConfigureCache


Declaration​

public void ConfigureCache(bool enabled, uint maxMb)

Summary​

Enable or disable the on-disk cache of downloaded mesh data, or change its budget. With
the cache enabled, downloaded geometry and textures are kept on disk per chunk.
Downloading the same asset again reads the chunks already on disk instead of the
network, and an interrupted download resumes where it stopped. The cache is off by
default. The Cache Enabled and Cache Max Mb fields in the Inspector apply
the same settings when this manager starts.

Remarks​

The setting applies to the native mesh downloader, which every LocationMeshManager
shares, so the last manager to start or to call this method wins. The change takes
effect at once, or when this manager starts if it has not started yet. A changed budget
also applies to downloads already in progress. Disabling only affects downloads started
afterwards and does not delete cached data: while the cache is disabled, nothing in the
cache directory is read, written or deleted, so the data is intact when the cache is
enabled again. Cached data never goes stale, because a re-run of the mapping pipeline
publishes new chunk IDs and an ID always names the same geometry.
Once the cache exceeds maxMb, the least recently used chunks are
removed until it fits. Size the budget above the total download size of the assets you
expect to hold. A smaller budget evicts chunks that are about to be needed again and
downloads them again indefinitely.

Throws​

  • ArgumentOutOfRangeException — enabled is true and maxMb is zero.

Parameters​

NameTypeSummary
enabledbool
Whether to cache downloaded mesh data on disk.
maxMbuint
Maximum disk space the cache may use, in megabytes. Must be greater than zero when
enabled is true.