I am using the Third Person Controller script from the Sample Assets on a instantiated player object and I keep getting these errors that I dont realy know how to solve.
Please Help me!
void PreventStandingInLowHeadroom ()
{
// prevent standing up in crouch-only zones
if (!crouchInput) {
Ray crouchRay = new Ray (rigidbody.position + Vector3.up * capsule.radius * half, Vector3.up);
float crouchRayLength = originalHeight - capsule.radius * half;
if (Physics.SphereCast (crouchRay, capsule.radius * half, crouchRayLength)) {
crouchInput = true;
}
}
}
The error is on the Ray crouchRay row and it says :NullReferenceException: Object reference not set to an instance of an object.
I am not quite sure what reference I am suposed to set…