Skip to main content

Tracker

A class in Root.Township, the global namespace.

Gives a network entity a saved name so it can be found again by that name, even after a restart. Added by the debug tracking console commands (server owner only).

Constructors​

MemberWhat it is
Tracker()Creates a Tracker with default values.

Fields​

MemberWhat it is
protected static Logger loggerNLog logger for tracker events.
2 private and internal fields
MemberWhat it is
private static HashSet<string> removingNames whose removal was requested before the tracker had loaded.
private static Dictionary<string, Tracker> trackersLookup of tracked name to Tracker, for loaded entities only.

Properties​

MemberWhat it is
NetworkEntity Entity { get; private set; }The network entity this tracker is on.
string Name { get; private set; }The name this entity is tracked under.
1 private and internal property
MemberWhat it is
private string Alta.Saving.ISavableSaveBase.name { get; }Save name for this savable, always Tracker.

Methods​

MemberWhat it is
static void Create(NetworkEntity entity, string name)Adds a Tracker component to the entity and registers it under the given name.
static NetworkEntity Get(string name)Returns the entity tracked under a name, or null if none is loaded.
void Load(TrackerData data, ISerializeChildren childSerializer)Restores the name from save and re-registers it. Removes it at once if a remove was queued while it was unloaded.
static void Remove(string name)Static: removes the named tracker, or queues the removal until it loads. Instance: unregisters it and its extra savable.
TrackerData Save(ISerializeChildren childSerializer)Saves the tracker's name.
4 private and internal methods
MemberWhat it is
private void Awake()Finds the entity, hooks its scene destroy event and registers this tracker as an extra savable on it.
private void Destroyed(NetworkEntity entity, bool isUnload)Drops the tracker from the lookup when its entity is destroyed or unloaded.
private void Initialize(string name)Sets the name and adds this tracker to the lookup.
private void Remove()Static: removes the named tracker, or queues the removal until it loads. Instance: unregisters it and its extra savable.