Hi, I’m relatively new in Unity and I’m using sphere colliders in collision detection on a Sphere GameObject. I used the following methods:
- Collider.OnCollisionEnter
- Collider.OnTriggerEnter
but no one is callled in despite of a sphere has collided on a plane. This is the script of the sphere:
public class Particle : MonoBehaviour {
void OnCollisionEnter(Collision collision)
{
Debug.Log("Entered");
}
void OnTriggerEnter(Collider other)
{
Debug.Log("Entered");
}
void Awake()
{
collider.isTrigger = true;
}
// Update is called once per frame
void Update () {
}
// Use this for initialization
void Start () {
renderer.material.color = Color.blue;
}
}
What I’m doing wrong?
Greetings