Trigger enter unity code example
Example 1: unity on trigger enter
//for unity c#
private void OnTriggerEnter(Collider other)
{
// code
}
Example 2: unity c# on trigger enter with specific gameobject
void OnTriggerEnter(Collider other)
{
if(other.gameObject.name == "Object name")
//Object name is the name of the GameObject you want to check for collisions with.
{
//What you want to do on trigger enter
}
}
Example 3: ontriggerenter
private void OnTriggerEnter(Collider other)