Skip to main content

SphereVisibilityCheck

A class in Root.Township, the global namespace.

Client: registers a sphere with the culling group and raises events when it comes into or goes out of the camera's view. Not used on headless servers.

Constructors​

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

Fields​

5 private and internal fields
MemberWhat it is
private UnityEvent becameInvisibleInspector event raised when the sphere leaves view.
private UnityEvent becameVisibleInspector event raised when the sphere comes into view.
private int cullingIndexIndex of the registered sphere in CullingGroupHandler.
private Vector3 visibilityCenterOffset of the sphere from the object.
private float visibilityRadiusRadius of the sphere.

Events​

MemberWhat it is
event Action BecameInvisibleRaised when the sphere leaves view.
event Action BecameVisibleRaised when the sphere comes into view.

Methods​

4 private and internal methods
MemberWhat it is
private void OnDestroy()Removes the sphere from the culling group.
private void OnDrawGizmosSelected()Draws the sphere in blue.
private void Start()Registers the sphere at its start position. It does not follow the object if it moves.
private void UpdateVisibility(CullingGroupEvent sphere)Culling callback that raises the inspector and code events.