Trigger FinishLine

So I’m working on a maze, My ball goes through the maze and I’m trying to make a finish line as a box as a collider with Is Trigger.

  • I created the object, box collider is checked, is trigger is checked.
  • I wrote a script, it compiles successfully.
  • I attach the script to the FinishPlane, create a gameobject > Ui > Text and then drag it into the text box labeled “Win Text” However the text is not triggered by the finish line.

Here is my code.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class FinishLine : MonoBehaviour {

	public Text winText;
	private bool FinishPlane = false;

	// Use this for initialization
	void Start () {
		FinishPlane = false;

	}

	void OnTriggerEnter(Collider col)
	{
		if (col.tag == "Player") {
			FinishPlane = true;
			winText.text="You Win!";
		
		}
	}
}

Check the type of your player collider. Not all collider types generate trigger events when they collide. See the tables here for more info.