C# OnTriggerEnter Issue

This question gets asked a lot and I’ve searched for a solution but I can’t seem to figure out why this function is not working. The trigger is not being triggered and they are on the same layer; no layers aren’t able to collide with each other. I want the game to detect when the player walks through a wall. This script is in the wall:

using UnityEngine;
using System.Collections;

public class wallScript : MonoBehaviour {

	void OnTriggerEnter (Collider player) {
		Debug.Log ("Triggered");
		if (player.gameObject.tag == "Player") {
			Debug.Log ("Player has passed through");
		}
	}
}

This is the wall:
71455-wall.png

This is the player:
71456-player.png

Well the wall has two collliders one of which the MeshCollider is a non-convex one and i guess the rigidbody on the wall is non-kinematic. Unity 5 doesn’t support a non-convex MeshCollider on a non-kinematic rigidbody gameobject. I guess that might be the problem. Try setting the MeshCollider to convex or if you don’t need it simply remove it. Also, instead of finding the GameObject using player.gameObject.tag == “” use player.CompareTag(“”), because later one compiles to fewer CIL instructions than the direct comparison i.e. it probably results in a single call to the CompareTag internal function, while the former alternative, hence giving better performance.

@STeelArrow21 I believe I’ve had this kind of problem before. Here’s what I think you should do as your code is Ok. Double check if your player character has the tag “Player”. Just to be sure if it does put another tag and again set it back to Player tag. Most times the problem is with the tag comparison.
Try debugging with this. If it logs then your problem is truly from you tags.

if (player) {
Debug.Log (“Player has passed through”);
}

What about the layers of these objects? Do they have a layer set? Are the layers set up to collide in the physics matrix?