Skip to main content

VisibilityDetector

A class in Root.Township, the global namespace.

Raises events when the renderer on the same object becomes visible to or hidden from any camera. Client side; the build bake fails if there is no renderer.

Constructors​

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

Fields​

2 private and internal fields
MemberWhat it is
private AltaEvent becameInvisibleSerialized event behind BecameInvisible.
private AltaEvent becameVisibleSerialized event behind BecameVisible.

Properties​

MemberWhat it is
bool IsVisible { get; private set; }Whether the renderer is currently seen by a camera.

Events​

MemberWhat it is
event Action BecameInvisibleRaised when the renderer is no longer seen by any camera.
event Action BecameVisibleRaised when the renderer is first seen by a camera.

Methods​

3 private and internal methods
MemberWhat it is
private void OnBecameInvisible()Unity callback; clears IsVisible and raises BecameInvisible.
private void OnBecameVisible()Unity callback; sets IsVisible and raises BecameVisible.
private void IBuildRendererPostBake.PostBake()Build step: throws if the object has no Renderer, naming the root object.

Used in​

Members of other types that take, return or hold a VisibilityDetector: