|
Hi this is my first post so go easy on me. I have searched but cant find info on a way to count the number of hits an object receives and and destroy it after it has been hit say 5 time. My guess is that I need to count the number of collisions in a variable and then when the variable = 5 destroy object. But I can figure out how to do that. Oh yes and the object to destroy is an instance. I have been trying to adapt this script that destroys after a period of time but no joy so thought i would put my hand up.
(comments are locked)
|
|
for seeing if the object is getting hit 5 times I'd think you'd simple do this... Hey Eli thought I would just let you know that that worked great thanks. Applied it as a separate script instead of making it part of my instantiate script. It didnt like having two OnCollisionEnters and I couldnt make it work inside the existing function. Not sure if that's a bad thing to do but it work. Thanks
Jun 13 '11 at 09:07 AM
jammerjar
@jammerjar if Eli's solution fixed your problem, please accept it as the answer to your question.
Jun 13 '11 at 03:47 PM
Chris D
(comments are locked)
|

Remember, you can format code by using the button with 0s and 1s on it.
Ok was wondering how i did that - thanks