Destroying object, no triggers/collisions on duplicated objects after

Hi all.
For example, I have an object, and other, which is duplicated from first.
And I have player object. When player triggers first object, I make there Destroy(). Object destroys ok, but after this, no trigger with other (duplicated) object. What I am doing wrong?

1 Answer

1

What I have noticed while using Unity, and I am new to it, is that when you duplicate GameObjects in the editor, the duplicate is somehow inherently linked to the original.
For example, if you were to create a box and give it a red colour, and then duplicate it and try to give the duplicate a yellow colour, then the original box’s colour will also change to red.

This suggests that duplications is not a simple copy paste but something that also links the two objects to be the same.

What I would try in your case is to create a prefab out of the `GameObject` that you want to have copies of, and then use the [Object.Instantiate][1] method to create clones of the object.

@guitarxe - Duplicated objects, whether from a prefab or in the editor, share the mesh and the material. At edit time, any changes to the material will be reflected on all objects that share that material. So to create two objects that have different colors for example, you need two materials. At runtime, if you make changes in a Renderer.material, Unity clones the material, so changes to the material at runtime will only be made to the specific object.

–

I destroy objects in runtime, and I've observed, sometimes it works ok, but sometimes doesn't work as described. Objects are visible, only triggers doesn't work Also, I need to make objects in editor, by Object.Instantiate is hard to make level design :)

–