Skip to main content

GenericReplacer

A class in Root.Township, the global namespace.

Replaces this entity with another prefab at the same position and rotation. Server only; subclasses can change what happens to the old entity.

Constructors​

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

Fields​

2 private and internal fields
MemberWhat it is
private bool btnReplaceInspector button that runs Replace.
private NetworkPrefab targetPrefabPrefab spawned in place of this one.

Methods​

MemberWhat it is
void Replace()Server: spawns targetPrefab in this entity's chunk and calls OnReplace.
protected virtual void OnReplace(NetworkEntity replacing)Called with the new entity after spawning. By default destroys this entity.