Skip to main content

BasicObjectDisplay

An abstract class in Root.Township, Alta.Caves.Displays.

Base for cave chunk displays that place objects at each non-zero cell of a layer, either as network prefabs or as static unnetworked pieces.

Constructors​

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

Fields​

MemberWhat it is
protected NetworkPrefab[] prefabsNetwork prefabs to place. If empty, the static unnetworked pieces are used instead.
4 private and internal fields
MemberWhat it is
private PlatformFlags displayOnPlatforms this display renders on; on others Render does nothing.
private List<StaticEnvironmentPieceInstance> staticPiecesStatic environment pieces spawned by this display, released on destroy.
private GameObject[] unnetworkedObsolete list of plain prefabs; OnValidate converts it to unnetworkedPrefabs and clears it.
private StaticEnvironmentPiece[] unnetworkedPrefabsStatic environment pieces to spawn when no networked prefabs are set.

Methods​

MemberWhat it is
override IEnumerator Render()Returns the render coroutine, or null if this display is not enabled for the current platform.
protected virtual void OnValidate()Editor: converts the obsolete unnetworked GameObject list into static environment pieces.
protected void Process(int prefabIndex, Vector3 position, Quaternion rotation, Vector3 scale, int seed)Places one object: spawns the network prefab (kinematic, parented here) or a static piece run through static generation.
protected abstract IEnumerator RenderInternal()The subclass's render coroutine.
protected abstract void Spawn(int seed, int spawnSeed, int prefabIndex, int x, int z, float value, ref int index)Called per non-zero cell with a seeded prefab index; subclasses work out the placement and call Process.
protected IEnumerator SpawnAll() (iterator)Coroutine that calls Spawn for every non-zero cell and then registers renderers with the layer streamer on clients.
2 private and internal methods
MemberWhat it is
private void OnDestroy()Resets and releases every static environment piece this display spawned.
private void Spawn(int x, int z, float value, ref int index)Called per non-zero cell with a seeded prefab index; subclasses work out the placement and call Process.