Skip to main content

NetworkDestroyTimed

A class in Root.Township, the global namespace.

Destroys its entity after a set time plus an optional random extra. Server only; a top-level entity with this is never saved.

Constructors​

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

Fields​

3 private and internal fields
MemberWhat it is
private Timeline.IEntry entryTimeline entry for the scheduled destroy.
private float randomAdditionalTimeUp to this many extra random seconds are added.
private float timeSeconds before the entity is destroyed.

Methods​

MemberWhat it is
override void InitializeAsServer(SpawnData spawnData)Server: stops a top-level entity from saving and schedules Destroy.
2 private and internal methods
MemberWhat it is
private void Destroy()Destroys the entity across the network, first detaching it if it is embedded in a parent.
private void OnDestroy()Cancels the scheduled destroy.