var speed = 7.0;
var explosion : Transform;
function FixedUpdate () {
rigidbody2D.velocity.x = speed;
}
function OnCollisoionEnter2D (collision : Collision2D) {
if(collision.gameObject){
Instantiate(explosion,transform.position,transform.rotation);
Destroy(gameObject);
}
}
As far as I can tell there is no reason this shouldn’t work. For the love of God, please do not tell me to check if “IsTrigger” is checked or that I have Rigidbodies attached. I’ve checked everything 100 times.
Please, just give me the most idiot proof solution possible.
Thanks.