Timer to delete object?

I have balls that are spawned i want after 6 seconds after the balls are shot they destroy,

any ideas on how to do this?

thanks

var ball = Instantiate (ballPrefab);
Destroy (ball, 6.0);

–Eric

i seem to get this error:

Assets/Scripts/BallKiller.js(1,25): BCE0005: Unknown identifier: ‘ballPrefab’.

not sure what to do

That’s just an example; you’d use your own prefab name and your own code. It sounds like you may need to read the docs/do some tutorials so you can become familiar with Unity scripting.

–Eric

Thank you , I just figured it out

At first I was a bit confused sorry

If your struggling with simple things such as prefabs, before creating your own game i would suggest you would through these youtube example snippets of commonly used codes.