Skip to main content

ColliderGroup

A class in Root.Township, the global namespace.

A ComponentGroup of colliders with helpers to switch them on and off, set their layer, and ignore collisions with other colliders.

Constructors​

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

Fields​

4 private and internal fields
MemberWhat it is
private bool isAcceptingTriggersWhen false, trigger colliders are left out of the group.
private bool isDeletingAllInspector button labelled Delete All Colliders; does nothing in this build.
private bool isDisablingInternalCollisionOnStartIgnores collisions between the group's own colliders on Start.
private static Logger loggerNLog logger for this class.

Methods​

MemberWhat it is
static IEnumerator IgnoreCollisionsCoroutine(IEnumerable<Collider> colliders, IEnumerable<Collider> otherColliders, float secondsToIgnore = 0.1) (iterator)Coroutine that ignores collisions between two sets of colliders for a time, then restores them.
static AltaCoroutine IgnoreCollisionsForDuration(IEnumerable<Collider> colliders, IEnumerable<Collider> otherColliders, MonoBehaviour nullCheck, float secondsToIgnore = 0.1)Starts IgnoreCollisionsCoroutine, stopping if the given behaviour is destroyed. Default 0.1 seconds.
void IgnoreSelf(bool isIgnoring = true)Makes the group's colliders ignore each other (or stop ignoring). Runs on Start if set to.
virtual void SetActive(bool isEnabled)Enables or disables every collider in the group.
void SetIgnore(Collider ignore, bool isIgnoring)Ignores or restores collision between the group and a collider, another group, or a list of colliders.
void SetIgnore(ColliderGroup ignore, bool isIgnoring)Ignores or restores collision between the group and a collider, another group, or a list of colliders.
void SetIgnore(IEnumerable<Collider> ignore, bool isIgnoring)Ignores or restores collision between the group and a collider, another group, or a list of colliders.
void SetLayer(int layer)Moves every collider's object to a layer.
protected virtual void IgnoreCollision(Collider thisCollider, Collider otherCollider, bool isIgnoring)Ignores or restores collision between two colliders. Subclasses can override it.
protected override bool IsElementValid(Collider element)Skips trigger colliders when the group does not accept triggers.
protected override void OnValidate()Editor hook. Does nothing useful.
1 private and internal method
MemberWhat it is
private void Start()Turns off collisions between the group's own colliders when isDisablingInternalCollisionOnStart is set.

Used in​

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