getting raycast working on prefabs made from resources created at runtime

Hi Im having some problems with created (prefab) gameObjects and a raycast. I've created some cubes in the game with BoxColliders and using:

        if (Physics.Raycast (ray, hit, 100.0)) {
        distanceToGround = hit.distance;
        Debug.DrawLine (ray.origin, hit.point);
    }   

to show me this in the editor. This works fine. I then created a new gameObject:

var myNewObj = Instantiate(newObject,Vector3.zero,Quaternion.identity);

where newObject is a prefab created beforehand from a resource. What do I have to do to get the raycast working on this object? a box collider would do. I tried:

        var myNewObjRigbody = myNewObj.gameObject.AddComponent("Rigidbody");
    myNewObjRigbody.isKinematic = true;
    myNewObj.gameObject.AddComponent("BoxCollider");

The gameObject gets a rigidbody and a boxcollider, but my raycast does not show up? Do I need to reinitiate something for the raycast to work? does the original file have to be somewhere else as in the resource file, with which I created the prefab. I checked the layers aswell, both are in Default.

thxs Ent

Added complete script: its the: Debug.DrawLine (ray.origin, hit.point); not showing up whats bothering me. Im will add a colliderBox to the prefab to check if its something else. The DistanceToGround is confusing because I havent changed the Var name from the example I had, should be DistanceToCamera.

objectscript (JS):

var counter : int = 0;
var modWidth : int = 900;
var modHeight : int = 900;
var modDepth : int = 900;
var modScale : float = 0.005;
var newObject : Transform;
function Update () {
if (Input.GetButtonDown("Fire1")){
    var newPos = new Vector3((modWidth*counter*modScale),0.0,(modHeight*0.5*modScale));
    var newScale= new Vector3(modScale,modScale,modScale);
    var newRot = new Vector3(270.0,180.0,0.0);
    var myNewObj = Instantiate(newObject,Vector3.zero,Quaternion.identity);
    var myNewObjRigbody = myNewObj.gameObject.AddComponent("Rigidbody");
    myNewObj.localPosition = newPos;
    myNewObj.localScale = newScale;
    myNewObj.localRotation = Quaternion.Euler(newRot);
    myNewObjRigbody.isKinematic = true;
    myNewObj.gameObject.AddComponent("BoxCollider");
    counter++;
}
}

objectscript (CS):

int counter = 0;
int modWidth = 900;
int modHeight = 900;
int modDepth = 900;
float modScale = 0.005f;
//GameObject  newObject;
void  Update (){
    if (Input.GetButtonDown("Fire1")){
        Vector3 newPos= new Vector3((modWidth*counter*modScale),0.0f,(modHeight*0.5f*modScale));
        Vector3 newScale= new Vector3(modScale,modScale,modScale);
        Vector3 newRot= new Vector3(270.0f,180.0f,0.0f);
        GameObject myNewObj = Instantiate(Resources.Load("hocker"),Vector3.zero,Quaternion.identity) as GameObject;
        //TYPE?!? myNewObjRigbody= myNewObj.gameObject.AddComponent<Rigidbody>();
        myNewObj.transform.localPosition = newPos;
        myNewObj.transform.localScale = newScale;
        myNewObj.transform.localRotation = Quaternion.Euler(newRot);
        //myNewObjRigbody.isKinematic = true;
        myNewObj.gameObject.AddComponent<BoxCollider>();
        counter++;
    }
}  

camerascript:

function Update(){

var hit : RaycastHit;
var ray = Camera.main.ScreenPointToRay (Input.mousePosition);
//Just a check if over GUI or not
if (!onMouseOverMenu) {
    if (Physics.Raycast (ray, hit, 100.0)) {
        distanceToCamera = hit.distance;
        Debug.DrawLine (ray.origin, hit.point);
    }   
}
}

gameObject.layer = numOfLayer;

Regarding your main question we could use some info. You don't say how you create the ray, where your ground is and if/where you move the new object. If your ground is at (0,0,0) and you create a new object at the same position a raycast will probably not hit this object...

I checked your script and it works for me. Only thing I changed was the camera script:

public class CamerScript : MonoBehaviour {

    void Update() {

        RaycastHit hit = new RaycastHit();
        Ray ray = Camera.main.ScreenPointToRay (Input.mousePosition);
        //Just a check if over GUI or not
//      if (!onMouseOverMenu) {
            if (Physics.Raycast (ray, out hit)) {
                float distanceToCamera = hit.distance;
                Debug.DrawLine (ray.origin, hit.point);
            }   
//      }
    }
}

It draws the rays for manually placed items as well as for instantiated prefabs. Maybe you should check out if the colliders are configured correctly on the instantiated prefabs?