BCE005: Unknown Identifier :'KDefaultraycastLayers'

I'm getting the error BCE005: Unknown Identifier :'KDefaultraycastLayers' when trying to run my project.

I'm using version 3.3.0f4 (63235).

Code as below:

var blockHeight : float = 1.0;
var blockMaterial : Material; 
var blockPhysicMaterial : PhysicMaterial;

private var mouseHit : Vector3;
private var dragging : boolean = false;

function MousePoint() : Vector3{ 
    var ray = GameObject.FindWithTag("MainCamera").camera.ScreenPointToRay(Input.mousePosition); 
    var hit : RaycastHit;
    Physics.Raycast(ray, hit, 100, kDefaultRayCastLayers);
    return hit.point;
}

function OnMouseDown(){ 
    mouseHit = MousePoint();
    mouseHit.z =  0;
    dragging = true;
}

function OnMouseUp(){ 
    dragging = false;
}

function Update () {
    if(dragging){
        GetComponent(LineRenderer).enabled = true;
        GetComponent(LineRenderer).SetPosition(0, mouseHit);
        GetComponent(LineRenderer).SetPosition(1, MousePoint());
    } else {
        GetComponent(LineRenderer).enabled = false;
    }
}

@script RequireComponent(LineRenderer)

Any ideas as to why?

1 Answer

1

I think you want `kDefaultRaycastLayers`


edit

Oh, after fixing your code highlighting i’ve saw you use the right name (with lowercase “k”).

I’ll check that…

... Well I've found it ;)

It’s a class variable of Physics. So use:

Physics.kDefaultRayCastLayers