Method not found: Unity Engine.BoxCollider.RayCast,

Hi, when gamer click on the terrain then I save it as Array, but I want to use this Array in other script, it shows the error as follow.

Missing Method Exception: Method not found: Unity Engine.BoxCollider.RayCast, Boo.Lang.Runtime.DynamicDispatching.MethodDispatcherFactory.ProduceExtensionDispatcher()

my code: (attach to terrain)

static var  checkPointArray = new Array();

static var checkPointSequence = 0;

var checkPoint : Transform;

function Update(){

    var ray : Ray = Camera.main.ScreenPointToRay (Input.mousePosition);

    var hit : RaycastHit;
    if (collider.Raycast (ray, hit, 200.0)) {

        Debug.DrawLine (ray.origin, hit.point);

        if(Input.GetButtonDown("Fire1")){
        Instantiate ( checkPoint, hit.point , Quaternion.identity); 
        checkPointArray[checkPointSequence] = hit.point;
        checkPointSequence ++;
        }
    }
}

*enemy's code( move to the coordinate) *

var arr = terrainPosition.checkPointArray[0];

or

var num = terrainPosition.num;

I try many times to get the array or the sequence, but the error occur..

I really appreciate your help..

Try Physics.Raycast instead of collider.Raycast

As in the documentation code example, you need to use #pragma strict (in Unity 3 you also need #pragma downcast) when using Collider.Raycast in JS. Either that, or use the actual collider type (BoxCollider or whatever) instead of just collider.

Alternatively you simply need to cast your collider...

   if ((collider as BoxCollider).Raycast (ray, hit, 200.0)) {

But I would love to hear an answer from Unity about why this is even required as polymorphism is inherent to the language.