OnCollisionStay melee

Script:

function Update(){

}

function OnCollisionStay (col : Collider){
if(Input.GetButtonDown(“Fire1”)){
Destroy.this.gameObject;
}
}
End of Script

I am still pretty bad at coding, so can someone help me?
The goal of this is to get a cube that will be invisible as a colliding trigger. I am not fighting enemy AI’s with this code, but rather I need this to break in game objects like in minecraft.

Thanks for the help!

First, please spell out your problem. Second, format your code.

I noticed a few possible problems in your question because you didn’t make it clear i will just try to answer them all, (I need something to do right now anyway. )

  1. invisible cube, if that was your problem then uncheck the mesh renderer component
  2. to make the cube follow you make it a child of your character
  3. change Destroy.this.gameObject to Destroy(col.gameObject)

I think that’s everything. Sorry i was a little harsh at the top of my answer. I know how tough it is to be just starting out with Unity. good luck solving your problem. I hope this help.

Quishtay™ all the way