I was working on a bomb script to make the game object detonate after set time. I’t didn’t work! Can someone help.
Here, try this:
var explosion : GameObject;
var life = 5.0;
function Start () {
Invoke ("Kill", life);
}
function Kill () {
var pos = transform.position;
var rot = transform.rotation;
if (explosion)
Instantiate (explosion, pos, rot);
Destroy (gameObject);
}
jeez got to be quick around here!
Here is a package of my example. Which is basically exactly the same as the code supplied above. Just nice for future people with similar requests to have a working example. I know I appreciated it when I was starting out.
Cheers.
39449–1466–$timebombunitypackage_870.zip (47.6 KB)
Ya, you’re right. I know exactly how you feel.