OnCollision2DActivator - CodingDino/Dino-Unity-Toolkit GitHub Wiki

The OnCollision2DActivator component triggers an action whenever a different GameObject collides with the GameObject the component is attached to. Both GameObjects must have a Collider2D of some type attached to them. Extra conditions can be set to only react when certain objects collide, or to react when the collision ends or while it is occurring.

This is an Activator component, and does nothing on its own, instead triggering a linked Action component. Actions, Activators, and Data make up the core system for the Dino Unity Toolkit.

Image: An OnCollision2DActivator set up to react when a GameObject called "Player" touches it, and disable that object.

Properties

Conditions

These are the conditions which must be met in order for the actions to be triggered.

Property: Description:
Check Name Check this if the activator should only respond if the GameObject colliding has a specified name.
Target Name The name that the colliding GameObject must have to trigger this Activator. This must match EXACTLY.
Check Tag Check this if the activator should only respond if the GameObject colliding has a specified tag.
Target Tag The tag that the colliding GameObject must have to trigger this Activator. This must match EXACTLY.
Check Layer Check this if the activator should only respond if the GameObject colliding is on the specified layer.
Target Layer The layer that the colliding GameObject must be on in order to trigger this Activator. This must match EXACTLY.

Actions

These are the lists of actions that will be activated when the above conditions are met

Property: Description:
On Collision Enter () Activates when a GameObject meeting the above conditions first touches this GameObject.
On Collision Stay () Activates every frame while a GameObject meeting the above conditions is touching this GameObject.
On Collision Exit () Activates when a GameObject meeting the above conditions stops touching this GameObject.