OnTriggerEnter will not work in unity 5

void OnTriggerEnter(Collider other)
{
Debug.Log(other);

}

other would be my player which only have a rigidbody and and box collider on it .
the object with the trigger set to active is just a simple box with this script on it .

how can i get OnTriggerEnter to work

Both objects involved in a collision need to have colliders. So, the “just a simple box” to which this script is attached needs to have a collider component as well.

For OnTriggerEnter to function, the Collider on the object with which the script is attached must be checked “IsTrigger”.

I had same issue and I had to set both of my colliding Gameobjects on the “CollisionLayer”. Then it worked :wink: I don’t know if this is a new feature of Unity5 but I can tell I spent most of the day searching for a solution… Hope that helps…

um… I’m abit new to this so i may be wrong but when you use debug.log you may need quotations. Like

void OnTriggerEnter2D(Collider2D other)//if you are using 3D you dont need the 2D part
{

Debug.log (“Hi There”);
}

What is this?

Debug.Log(other);

I’m quite sure you can’t output a Collider to the Console.

Did you want

other.gameObject.name

instead?

Use the new Unity UI Event Systems. Include Using.UnityEngine.EventSystems at the top and make sure that your class inherits from IPointerEnterHandler.

Then set up an Event System on the Player and use the following script in your code attached to it.

void OnPointerEnter(PointerEventData pointerData)
{

}