3d collision detection with a character controller., I cant get my collision detection working.

Here is the code

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;

public class CollisionHandler : MonoBehaviour
{   
    void OnCollisionEnter (Collision other)
    {   
        if (gameObject.tag == "Spikes")
        {
            reloadlevel();
        }
        else 
        {
            Debug.Log("sae");
        }
    }

    void reloadlevel()
    {   int currentSceneIndex = SceneManager.GetActiveScene().buildIndex;
        SceneManager.LoadScene(currentSceneIndex);
    }
}

I can get it to work with an object that does not have a character controller. How do I get it to work with one?

It’s been awhile since I’ve worked with CharacterControllers but if I remember correctly they don’t get the same messages as Rigidbodies based gameobjects.

The function for handling collision when the player moves is OnControllerColliderHit.
It takes a parameter of type ControllerColliderHit which you can poll in a similar way to OnCollisionEnter to work out what it hit and act accordingly.