Collision problem

Hello!

I try making a box, which I touch with the character (fps controller), it loads the next level.

I add a script to the box (not to the controller, with the controller and OnControllerCillisionEnter it works):

using UnityEngine;
using System.Collections;

public class OnHit : MonoBehaviour 
{		
	void OnCollisionEnter (Collision cInfo)
	{
	      Application.LoadLevel("TestScene");
	}
}

What’s the problem with this?

It’s working now!

  • On the box (cube) is a box collider, with isTrigger and I attached the script.
  • I add rigidbody to the controller.

The Script:

using UnityEngine;
using System.Collections;

public class OnHit : MonoBehaviour 
{		
	void OnTriggerEnter (Collider cInfo)
	{
		Debug.Log("Hit the Cube");
		
		if(cInfo.gameObject.name == "First Person Controller")
		{
			Application.LoadLevel("TestScene1");
		}
	}
}

The OnTriggerEnter event works fine.

Thanks the help!