CharacterController.detectCollisions Manual     Reference     Scripting  
Scripting > Runtime Classes > CharacterController
CharacterController.detectCollisions

var detectCollisions : bool

Description

Should other rigidbodies or character controllers collide with this character controller (By default always enabled)

This method does not affect collisions detected as part of the character movement. Instead it controls collisions between the controller and other objects. For example a box will block the movement of the controller, but the box can fall through the controller as part of the simulation. This is useful to temporarily disable the character controller. Eg. you might want to mount a character into a car and disable collision detection until you exit the car again. Note that this only affects other bodies to not collide with r detectCollisions is not serialized. This means, it doesn't show up in the inspector and when Instantiate'ing the controller or saving it in a scene it will not be saved.

JavaScripts
var c : CharacterController;
c = GetComponent(CharacterController);
c.detectCollisions = false;

using UnityEngine;
using System.Collections;

public class example : MonoBehaviour {
public CharacterController c;
void Awake() {
c = GetComponent<CharacterController>();
c.detectCollisions = false;
}
}

import UnityEngine
import System.Collections

class example(MonoBehaviour):

public c as CharacterController

def Awake():
c = GetComponent[of CharacterController]()
c.detectCollisions = false