Unity CC Slope-Skipping

Trying to work out the familiar “slope skip” caused by walking a Unity Character Controller down an incline. If you don’t already know, the horizontal motion of CC.Move puts itself in the air ever so slightly when walking on a downward slope, which gravity doesn’t correct until the following frame, resulting in a skipping effect. This is a major problem when isGrounded is used to check for jumping, animations, etc.

My first idea once I realized this was an issue was actually the exact solution used here. This didn’t work for me for some reason. My slightly modified version:

    var slopeAdjust     : float = 0.0;    //Compensation amount
    var floorInfo       : RaycastHit;     //Raycast storage var
    var stepUpMax       : float = 0.1;    //CC step offset, also used in slope compensation

    if (Physics.Raycast (transform.position, -Vector3.up, floorInfo, (controller.height/2 + stepUpMax)  controller.isGrounded  (floorInfo.distance > controller.height/2)
    { 
        slopeAdjust = hit.distance - controller.height/2; 
    }
    else
    {
        slopeAdjust = 0;
    }

    transform.position.y -= slopeAdjust.y;

This is placed after the Move function, so a translation to the point of contact with the ground should occur, with distance found by a raycast downward from the position of the CC. It also checks that the raycast collision point is at least below the foot of the CC so it doesn’t compensate when it doesn’t need to. I also tried replacing controller.isGrounded in the conditional statement with a variable that is updated with isGrounded once per frame, because I suspected that CC updates isGrounded after a Move function, but that didn’t help. Also, be aware that the unmodified solution that seemed to work for other person also didn’t work.

I’m aware that the manual suggests using only one Move per frame (for cost purposes?), but just to see, I tried Move-ing in the x-direction first, them Move-ing in y directly after to see if it would put the character on the ground avoiding pre-Move collisions, but even that did nothing.

I have a really messy fix in place that increases gravity by a large factor when isGrounded, but this causes other problems and I want to avoid doing this.

A few other details:
-I have trigger colliders as children to the CC, but I was sure to remove them when testing the compensation script.
-I noticed an error in the raycast distance caused by the CC height being slightly too short. I fixed this.
-Very gradual slopes don’t cause skipping.

I came up with a really quick and dirty solution to this problem.

First of all, instead of moving left or right, I move along the parallel of the collision axis. Second, I just move the character down by 0.1 if its moving on the ground and jump hasn’t been pressed.