I have a sphere which I pick, and you can see that I have physics functions which work perfectly. But for some reason, I can’t get the code to destroy the object. It should be simple, so something is probably staring me in the face. Any help would be appreciated.
As you can see in the comments in the code, I’ve tried the destroy function at several places. I have also tried the DestroyImmediate function. Everything else works so I know that the code is effecting the sphere ball. Can anyone tell me what I am missing?? Thanks.
Here is the code:
#pragma strict
//adds sphere ball from scene
var me1: Rigidbody;
function Start () {
me1.AddForce(new Vector3(50,200,0));
//these 2 destroys don’t work
//Destroy(me1)
//DestroyImmediate(me1)
}
function Update () {
if(Input.GetMouseButton(0)) {
Debug.Log(“Pressed left click.”);
//this Destroy does not work
Destroy(me1);
}
}