x


Born again object

hi, I have an animated cube from side to side frames 100 and my problem is that when it collides with a box Colider destroy it and not born again and this is my script:

function OnCollisionEnter(){ Destroy(gameObject); }

more ▼

asked Apr 27 '12 at 01:02 AM

gringofx gravatar image

gringofx
-10 14 25 25

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

When you execute the Destroy() method against a Game Object, the Game Object is destroyed. The script has done exactly what you have told it to do. If you want a new instance of a Game Object to be created to replace the one that was destroyed, it is up to your own logic to create a new instance. Commonly this is performed through the Instantiate() method.

more ▼

answered Apr 27 '12 at 01:20 AM

kolban gravatar image

kolban
1.8k 2 7

can you show me an example ?

Apr 27 '12 at 01:32 AM gringofx
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x5084
x440
x184
x142
x19

asked: Apr 27 '12 at 01:02 AM

Seen: 447 times

Last Updated: Apr 29 '12 at 02:38 AM