Skip to main content

WorldLandmarkManager

A class in Root.Township, Alta.Chunks.

Loads and unloads world landmarks (stand-in models of distant places) as the chunks they depend on load. Runs on clients, and on the server only in local test. Also the landmarks console module.

Constructors​

MemberWhat it is
WorldLandmarkManager()Unity makes components itself; use AddComponent or spawn a prefab instead of new.

Fields​

7 private and internal fields
MemberWhat it is
private WorldLandmark[] androidLandmarksLandmarks used on Android.
private static WorldLandmarkManager instanceThe current manager.
private bool isSetupTrue between Setup and Stop.
private WorldLandmark[] landmarksLandmarks used on Windows.
private static Logger loggerNLog logger for this class.
private Dictionary<Chunk, HashSet<WorldLandmark>> toLoadLandmarks shown when each chunk loads.
private Dictionary<Chunk, HashSet<WorldLandmark>> toUnloadLandmarks hidden when each static chunk loads.

Properties​

MemberWhat it is
static bool IsLandmarkLoadingEnabled { get; set; }Global switch for landmark loading. Default true.
WorldLandmark[] Landmarks { get; set; }The landmarks for this platform: the Android list on Android, the main list on Windows, otherwise null.

Methods​

MemberWhat it is
static void ForceUnloadAll()Unloads every landmark.
override void Initialize()Client: sets up if landmark loading is enabled.
override void InitializeAsServer(SpawnData spawnData)Server: sets up only in local test.
11 private and internal methods
MemberWhat it is
private void AttemptLoadLandmark(Chunk chunk)When a chunk fully loads, loads its landmarks that have a loaded chunk and none of their static chunks loaded.
private void AttemptLoadLandmarkFromStatic(Chunk chunk)When a static chunk begins unloading, loads the landmarks it was hiding and holds the unload until they finish.
private void AttemptUnloadLandmark(Chunk chunk)When a chunk fully unloads, asks its landmarks to check whether they should unload.
private void Awake()Sets the static instance.
private static void EnableLandmarks(bool enabled)Console landmarks enable: sets up or stops the manager.
private void ForceUnloadLandmark(Chunk chunk)When a static chunk fully loads, unloads the landmarks it replaces.
private void OnDestroy()Stops the manager and clears the instance.
private void ResolveChunkReferences()Has each landmark find its chunks.
private static void SetLoadingEnabled(bool isLoading)Console landmarks load-enabled: sets IsLandmarkLoadingEnabled and sets up if turned on.
private void Setup()Hooks each landmark's chunks' load and unload events, then loads the landmarks that should already show.
private void Stop()Unhooks all chunk events and resets each landmark.