Unity GameObject Copy Not working

Hi,

So I had a question. In Unity, I have a GameObject which represents a character. In it, there are two gameobjects, one for the ragdoll that replaces it upon death and one which contains the mesh and bones.

So here is the heiarchy:

->Character ->Ragdoll ->ragdoll bones

  ->ragdoll mesh

->Mesh
->normal bones
->normal mesh

Well the original works perfectly but I need to duplicate this and use new copies. The behavior is such: the character will face and follow the camera and upon collision, the mesh will be destroyed and replaced by the ragdoll mesh (death).

In my character creator game object script, I have a public GameObject variable that takes the original character that is working and just do an instantiate into a new GameObject. Next to the new one in the hiearchy, it always says "Character(Clone)".

However, the new models do not respond to collisions (die) and I am not sure why. Thanks so much for the help in advance. I think it might have something to do with deep copying but I am not sure.

Could you include some code from your character creator script? There are several things that could be wrong here and seeing what you're doing would make it a lot easier know which one it is.

Unless you really have a specific reason for the ragdoll being part of the character hierarchy, you could make it a prefab and do the same thing that the 3D platform tutorial (http://unity3d.com/support/resources/tutorials/3d-platform-game) does for the coppers.

Do you instantiate before or after death? If after death, do you reset the death stuff on the clone?

1 Answer

1

To make a game object respond to collisions or triggers, they need a collider and normally a rigidbody attached to them, and their colliding object needs at least a trigger collider. Without these assumptions, the collision and trigger events of the gameobject won’t receive a call.

Check out the table at the bottom of this page to understand how collider events are triggered