Class SurfaceMapView
Renders the live map into a RenderTexture on a world-space surface such as a scene plane or tabletop.
public sealed class SurfaceMapView : BaseMapView, ITilePipelineTarget, IMapFlyTarget
- Inheritance
-
objectObjectComponentBehaviourMonoBehaviourSurfaceMapView
- Implements
- Inherited Members
Fields
ArcMode
[Tooltip("When FlyTo takes the zoom-out-then-in arc: Auto only for far off-screen jumps, Never, or Always.")]
public FlyToArcMode ArcMode
Field Value
CacheDirectoryName
[Tooltip("Raster disk-cache folder. Unique per surface; two maps must not share a file.")]
public string CacheDirectoryName
Field Value
CapacityMode
[Tooltip("Automatic (default) sizes the tile array from this surface, max tilt, and GPU memory. Manual uses LayerCount.")]
public TileCapacityMode CapacityMode
Field Value
DiskCacheMB
[Tooltip("Disk cache cap, megabytes. 24 is enough for a small surface; do not use the fullscreen default.")]
public int DiskCacheMB
Field Value
ElevationEnabled
[Tooltip("Fetches real terrain height for ElevationSampler (see the tabletop terrain demo). Draws this surface's own tiles flat either way. Read at pipeline build; set before Play, or switch providers to apply.")]
public bool ElevationEnabled
Field Value
FadeAllLoads
True fades every tile load, not just level transitions; see ScreenMapView.FadeAllLoads.
[Tooltip("Fade every tile load, not just level transitions. Shipping default true.")]
public bool FadeAllLoads
Field Value
LabelFadeSeconds
Seconds a label fades in on winning declutter and out on losing it; 0 pops instantly.
[Tooltip("Seconds a label takes to fade in or out when decluttering changes which labels win. 0.3 default. 0 = instant. Can change while running.")]
public double LabelFadeSeconds
Field Value
LabelFont
[Tooltip("Optional font for marker labels and place labels; empty = built-in LegacyRuntime.ttf.")]
public Font LabelFont
Field Value
- Font
LabelSizePx
[Tooltip("Marker label font size in pixels.")]
public int LabelSizePx
Field Value
LayerCount
[Tooltip("Resident tile capacity in texture array layers. Read only when Capacity Mode is Manual.")]
public int LayerCount
Field Value
MaxFlySeconds
[Tooltip("Longest fly-to animation, seconds; long jumps saturate here.")]
public double MaxFlySeconds
Field Value
MemoryPolicy
[NonSerialized]
public TileMemoryPolicy MemoryPolicy
Field Value
PlaceLabelCacheDirectoryName
[Tooltip("Place-label disk-cache folder. Must be unique per surface; do not share with the raster cache or another map.")]
public string PlaceLabelCacheDirectoryName
Field Value
PlaceLabelsEnabled
[Tooltip("Upright place names over the surface. Off by default.")]
public bool PlaceLabelsEnabled
Field Value
ProviderConfig
[Tooltip("Tile source. Default OpenStreetMap is for trying the asset; pick your own before you ship.")]
public TileProviderConfig ProviderConfig
Field Value
Retina512Tiles
[Tooltip("Request 512 px @2x tiles where the selected provider serves them.")]
public bool Retina512Tiles
Field Value
SharedGroundStore
[NonSerialized]
public MarkerStore SharedGroundStore
Field Value
TargetRenderer
[Tooltip("Renderer that receives the map texture; defaults to this GameObject's.")]
public Renderer TargetRenderer
Field Value
- Renderer
TextureHeight
[Tooltip("RenderTexture height in pixels.")]
public int TextureHeight
Field Value
TextureWidth
[Tooltip("RenderTexture width in pixels.")]
public int TextureWidth
Field Value
TileFadeSeconds
Seconds a tile crossfades in on load or level transition; 0 pops instantly.
[Tooltip("Seconds a tile takes to fade in on load or level transition. 0.2 default. 0 = instant. Can change while running.")]
public double TileFadeSeconds
Field Value
TileMemoryBudgetMB
[Tooltip("GPU memory for this surface's tiles, megabytes. 0 = from the device. Set this low on a minimap.")]
public int TileMemoryBudgetMB
Field Value
TileMipsEnabled
[Tooltip("Mip chains and trilinear. About +33% tile memory. On by default. Set before Play.")]
public bool TileMipsEnabled
Field Value
TileUserAgent
[NonSerialized]
public string TileUserAgent
Field Value
WebGpuDirectUploadEnabled
[Tooltip("Browser only, experimental: skip a memory copy by uploading decoded tiles straight to the GPU. Off by default. Requires Web Worker Decode. Set before Play.")]
public bool WebGpuDirectUploadEnabled
Field Value
WebWorkerDecodeEnabled
[Tooltip("Browser only: decode tiles in a background worker so zooming stays smooth. Off by default. Set before Play.")]
public bool WebWorkerDecodeEnabled
Field Value
Properties
CurrentView
The transform answering every projection question for this view this frame; cached by the subclass, never allocate per read.
public override MapViewTransform CurrentView { get; }
Property Value
ElevationSampler
Ground height source this view's live terrain fetch has resolved, or null for a flat map (elevation off, or no live fetch has landed yet).
public override IElevationSampler ElevationSampler { get; }
Property Value
Remarks
Both subclasses build through the one TilePipelineHost
elevation fetch/lifecycle and forward its
ElevationTileSet.Sampler here - one data source for
whichever render mechanism each subclass actually uses (a
displaced tile mesh on a fullscreen map, a world-space mesh
draped over a tabletop's flat texture).
IsFlying
public bool IsFlying { get; }
Property Value
LayerStack
The ordered layer stack (named layers plus externally-registered overlays) this view draws every frame - see RegisterExternalOverlay(IMapScreenSpaceOverlay).
protected override MapLayerStack LayerStack { get; }
Property Value
Remarks
Each subclass owns a different concrete draw path (ScreenMapView through its MapDrawCoordinator, SurfaceMapView through its own render-into-texture loop), so this exposes whichever MapLayerStack instance actually backs it rather than assuming one shared implementation.
Markers
Bulk marker tier; non-null on both shipped map types from the moment the component exists.
public override MarkerLayer Markers { get; protected set; }
Property Value
Remarks
ScreenMapView builds it in Awake; SurfaceMapView creates it lazily on first read. Virtual so a subclass may choose either.
Output
public RenderTexture Output { get; }
Property Value
- RenderTexture
Polygons
Polygon tier; see Markers for the lifetime contract.
public override PolygonLayer Polygons { get; protected set; }
Property Value
Polylines
Polyline tier; see Markers for the lifetime contract.
public override PolylineLayer Polylines { get; protected set; }
Property Value
ResolvedUserAgent
public string ResolvedUserAgent { get; }
Property Value
Methods
ApplyTileDependencies()
protected override void ApplyTileDependencies()
CancelFly()
Stops an in-flight FlyTo(double, double, double?, double), leaving the view where it is.
public void CancelFly()
EffectiveLayerCount(int, int, TileTextureFormat)
Layer count that will actually be allocated: requested clamped down to the memory budget, never raised.
public int EffectiveLayerCount(int requested, int tileSizePx, TileTextureFormat format = TileTextureFormat.RGBA32)
Parameters
requestedintRequested layer count before the budget clamp.
tileSizePxintTile size in px used to convert the megabyte budget into layers.
formatTileTextureFormatUncompressed GPU format when
blockBytesPer4x4is 0.
Returns
EffectiveLayerCount(int, int, TileTextureFormat, int)
Layer count that will actually be allocated, including block-compressed tiles.
public int EffectiveLayerCount(int requested, int tileSizePx, TileTextureFormat format, int blockBytesPer4x4)
Parameters
requestedintRequested layer count before the budget clamp.
tileSizePxintTile size in px used to convert the megabyte budget into layers.
formatTileTextureFormatUncompressed GPU format when
blockBytesPer4x4is not positive.blockBytesPer4x4intBytes per 4x4 compressed block; 0 or negative uses the uncompressed arithmetic.
Returns
FlyTo(double, double, double?, double)
Animated fly to a coordinate, same arc as ScreenMapView's, snapping immediately when durationSeconds is not positive.
public void FlyTo(double lat, double lon, double? zoom = null, double durationSeconds = 0.3)
Parameters
latdoubleTarget latitude in degrees WGS84.
londoubleTarget longitude in degrees WGS84.
zoomdouble?Target zoom in Web Mercator zoom units; null keeps the current zoom.
durationSecondsdoubleRequested hop duration in seconds; nearby targets honor this exactly, far off-screen jumps take a longer zoom-out-then-in arc at their own pace, capped by MaxFlySeconds. See ArcMode to force or disable the arc.
RequestedLayerCount(int)
Layer count this surface asks for before the memory budget clamps it: Manual uses LayerCount; Automatic derives it from the render-target size and ignores tileSizePx.
public int RequestedLayerCount(int tileSizePx)
Parameters
tileSizePxintAccepted to match ITilePipelineTarget; Automatic reads the pipeline's tile size instead.
Returns
ResolvedElevationCoverageTiles()
The resolved elevation coverage tiles for this view, from the current view location and zoom; null if elevation is off.
protected override IEnumerable<TileCoord> ResolvedElevationCoverageTiles()
Returns
Remarks
Used by drift detection and the pipeline's initial build.
SetProvider(TileProvider, string, string)
Switches the tile provider and rebuilds the tile pipeline; before Start only the serialized fields change.
public void SetProvider(TileProvider provider, string style = "", string apiKey = null)
Parameters
providerTileProviderTile source preset.
stylestringProvider style name; empty is the provider default.
apiKeystringAPI key; null leaves the current key unchanged.
WorstCaseFootprint(int, int)
Worst-case visible tile count for a viewport of screenW x screenH under this surface's settings at max pitch.
public int WorstCaseFootprint(int screenW, int screenH)
Parameters
Returns
Events
ViewChanged
public event Action<MapViewChange> ViewChanged