Version: 2017.2 (switch to 2017.3b)
  • C#
  • JS

Script language

Select your preferred scripting language. All code snippets will be displayed in this language.


class in UnityEngine


Inherits from:Collider

Suggest a change


Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.


Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.



Switch to Manual


A CharacterController allows you to easily do movement constrained by collisions without having to deal with a rigidbody.

A CharacterController is not affected by forces and will only move when you call the Move funtion. It will then carry out the movement but be constrained by collisions.

See Also: Character Controller component and Character animation examples


centerThe center of the character's capsule relative to the transform's position.
collisionFlagsWhat part of the capsule collided with the environment during the last CharacterController.Move call.
detectCollisionsDetermines whether other rigidbodies or character controllers collide with this character controller (by default this is always enabled).
enableOverlapRecoveryEnables or disables overlap recovery. Enables or disables overlap recovery. Used to depenetrate character controllers from static objects when an overlap is detected.
heightThe height of the character's capsule.
isGroundedWas the CharacterController touching the ground during the last move?
minMoveDistanceGets or sets the minimum move distance of the character controller.
radiusThe radius of the character's capsule.
skinWidthThe character's collision skin width.
slopeLimitThe character controllers slope limit in degrees.
stepOffsetThe character controllers step offset in meters.
velocityThe current relative velocity of the Character (see notes).

Public Methods

MoveA more complex move function taking absolute movement deltas.
SimpleMoveMoves the character with speed.


OnControllerColliderHitOnControllerColliderHit is called when the controller hits a collider while performing a Move.

Inherited Members


attachedRigidbodyThe rigidbody the collider is attached to.
boundsThe world space bounding volume of the collider.
contactOffsetContact offset value of this collider.
enabledEnabled Colliders will collide with other Colliders, disabled Colliders won't.
isTriggerIs the collider a trigger?
materialThe material used by the collider.
sharedMaterialThe shared physic material of this collider.
gameObjectThe game object this component is attached to. A component is always attached to a game object.
tagThe tag of this game object.
transformThe Transform attached to this GameObject.
hideFlagsShould the object be hidden, saved with the scene or modifiable by the user?
nameThe name of the object.

Public Methods

ClosestPointReturns a point on the collider that is closest to a given location.
ClosestPointOnBoundsThe closest point to the bounding box of the attached collider.
RaycastCasts a Ray that ignores all Colliders except this one.
BroadcastMessageCalls the method named methodName on every MonoBehaviour in this game object or any of its children.
CompareTagIs this game object tagged with tag ?
GetComponentReturns the component of Type type if the game object has one attached, null if it doesn't.
GetComponentInChildrenReturns the component of Type type in the GameObject or any of its children using depth first search.
GetComponentInParentReturns the component of Type type in the GameObject or any of its parents.
GetComponentsReturns all components of Type type in the GameObject.
GetComponentsInChildrenReturns all components of Type type in the GameObject or any of its children.
GetComponentsInParentReturns all components of Type type in the GameObject or any of its parents.
SendMessageCalls the method named methodName on every MonoBehaviour in this game object.
SendMessageUpwardsCalls the method named methodName on every MonoBehaviour in this game object and on every ancestor of the behaviour.
GetInstanceIDReturns the instance id of the object.
ToStringReturns the name of the game object.

Static Methods

DestroyRemoves a gameobject, component or asset.
DestroyImmediateDestroys the object obj immediately. You are strongly recommended to use Destroy instead.
DontDestroyOnLoadMakes the object target not be destroyed automatically when loading a new scene.
FindObjectOfTypeReturns the first active loaded object of Type type.
FindObjectsOfTypeReturns a list of all active loaded objects of Type type.
InstantiateClones the object original and returns the clone.


boolDoes the object exist?
operator !=Compares if two objects refer to a different object.
operator ==Compares two object references to see if they refer to the same object.


OnCollisionEnterOnCollisionEnter is called when this collider/rigidbody has begun touching another rigidbody/collider.
OnCollisionExitOnCollisionExit is called when this collider/rigidbody has stopped touching another rigidbody/collider.
OnCollisionStayOnCollisionStay is called once per frame for every collider/rigidbody that is touching rigidbody/collider.
OnTriggerEnterOnTriggerEnter is called when the Collider other enters the trigger.
OnTriggerExitOnTriggerExit is called when the Collider other has stopped touching the trigger.
OnTriggerStayOnTriggerStay is called almost all the frames for every Collider other that is touching the trigger.

Did you find this page useful? Please give it a rating: