Character controller BUG...

Updated from Unity3d 2.6 to 3.5 and found out that my character controller which i use to move my character “gone crazy”… It moves only on planar surface and cannot move on the slopes((( it just stucks. But worked perfect in 2.6. Enemies are using CC also, but it works fine for them :face_with_spiral_eyes:
here’s unity web player for U to understand the problem:

http://ukcan.com.ua/WebPlayer.html

Played with all the attributes of CC - Slope limit, radius,skin width, step offset… nothing helps.
PLZ HELP :expressionless:

Found a piece which caused the problem :

void OnControllerColliderHit(ControllerColliderHit hit) {
	if(hit.gameObject.tag == "elevator"){
		transform.parent = hit.gameObject.transform;
		}
		else{
		      transform.parent = null;
		}

}

Please kill me, cuz i see no logic in it… WTF???

If you remove this code does it work?

BTW, I found if you walk into the moving platforms you can’t move away from then again, since I don’t think your code ever detaches your character’s transform from the elevator.

Ok, so i removed this code, and created separate script for elevator:

	private GameObject passanger;

	void OnTriggerEnter(Collider other) {
		passanger = other.gameObject;
		passanger.transform.parent = this.transform;
    }
	void OnTriggerExit(Collider other) {
		passanger.transform.parent = null;
		passanger = null;
    }

Now player can walk on the slopes with no problem, and elevators, but… when the player leaves the elevator, he remains parented to it…

now everything works like a charm :

	private GameObject passanger;

	void OnTriggerStay(Collider other) {
		if (other.transform.position.y > 0.3f){
		if(!passanger){
		passanger = other.gameObject;
		passanger.transform.parent = this.transform;
		}
		}
    }
	void OnTriggerExit(Collider other) {
		if(passanger){
		transform.DetachChildren();
		passanger.transform.parent = null;
		passanger = null;
		}
    }