Colliders


Colliders work with the other features in the Game Structure section to provide functionality for reacting to Physics collisions (both 2D and 3D) and the automatic changing of things like health and scores.

Generic Collider

The GenericCollider component can be used for general collision handling and is also the base for the other colliders described below that extend with additional functionality.

genericcollider

Generic Collider

Add the generic collider to any gameobject that has a physics collider, match the Colliding Tag field with the tag of the gameobjects that you want it to react with and then setup the rest of the fields to control the behaviour when collisions occur (tooltips in the editor give more information on the individual fields). You can setup what happens when a gameobject that matches the colliding tag enters a trigger, is within a trigger and when they leave a trigger. Options include enabling / disabling gameobjects, playing audio, instantiating or prefabs. There is also support for spawning of pooled items from Pro Pooling such as particle effects and so reducing CPU load.

You can create new custom colliders by inheriting from GenericCollider and overriding the EnterOccurred, StayOccurred and ExitOccurred methods.

Other Colliders

There are few other colliders provided that extend GenericCollider with additional functionality.

Coin Collider

CoinCollider gives additional options as shown below that allow for changing the Player and / or Level coins when a collision occurs.

coincollider

CoinCollider additional settings

Points Collider

PointsCollider gives additional options as shown below that allow for changing the Player and / or Level score when a collision occurs.

pointscollider

PointsCollider additional settings

Health Collider

HealthCollider gives additional options as shown below that allow for changing the Players health when a collision occurs.

See also

If you have any thoughts or suggestions on improvements or additions to the Colliders features then please let us know!