Character keeps falling through terrain (with colliders)

Hello I am an architecture student looking to use unity to create a game where I can walk through my digital models. I followed this tutorial FIRST PERSON MOVEMENT in Unity - FPS Controller - YouTube to make a first person controller and then I created a terrain under it with a collider. The first person controller component seems to have a collider built into it as well. However, when I run the game, the character always falls through the terrain. Shouldn’t this work? I have looked through countless forum threads on this topic and haven’t found any answers other than “make sure you have colliders.”

I am also wondering why there are no longer any first person prefabs in unity like I’ve seen in some older tutorials. I feel like that would make this process a whole lot easier. I feel like I’ve tried everything (though I know I haven’t) and nothing works! Please let me know if you have any suggestions or advice, thanks!

Hi,
I used this tutorial as well so i’m far from an expert but will try my best to help you as i managed to get mine working, are you able to snipping tool your script and inspector of the Player so i can compare it to mine ?
Thanks

There may be various reasons of that, the most likely reason is that:

1-The collider of the terrain and the collider of your character(first person controller) is overlapping make sure they are not overlapping themselves.

If that dosen’t work

2-You may have set the gravity so big that Unity could not calculate the colliding fast enough (by “big” I mean at least a few thousands).
3-The gravity variable may be higher than the height of your character.
4-Your teraain data may not be right. (Inspector → Terrain Collider).

If none of them works you should do something extra. Like:

1- Assign a rigidbody (not rigidbody2D) component and make sure you havent frozen any positions, is kinematic is set to wrong and use gravity is set to true. (You can delete the part of the code that creates a gravity because you are not going to need that anymore).
if problem continues
2- Assign a collider to your character. (make sure “Is trigger” is false)

if none of the solutions solve your problem please inform me about it so I can continue to help you
hope that helps

I had this problem, but it was for a slight variation of reason #1 that @Zymurer gave. The troublesome BoxCollider2D was not my player or terrain, but one accidentally added to 1/10 of my background game object children while testing something else entirely unrelated in the level. I have a decent number of game objects in the hierarchy so it’s a newbie mistake, but hopefully someone will read this and remember to comb through the other objects in the hierarchy as well.

None of the above answers came close to solving it for me.
After a day of brain scratching, I came up this beauty that I added to my character controller update function …it checks to see if your character has been pushed under the active Terrain and if so it applies an equivalent opposite transformation. You want to avoid adding force to the rigidbody for this because that can create a bobbing effect. Also, when logging this.transform.position.y - Terrain.activeTerrain.SampleHeight(this.transform.position) on natural ground I was given the float value of about 1 (it was more like 1.00000000545342 and it changed as I ran around) so I gave my int variable naturalYDistance the value of 1, since I never went below that. Then I checked, if my current position was ever less then my natural distance then I should add an opposite value to my transform.position and I was never pushed through the ground again.

    int naturalYDistance = 1;
    float playerPositionCalculatedY = this.transform.position.y - Terrain.activeTerrain.SampleHeight(this.transform.position);
    if (playerPositionCalculatedY < naturalYDistance)
    {
        float pushHeight = 1 - playerPositionCalculatedY;
        transform.position += new Vector3(0, pushHeight, 0);
    }