- Home /
What to do with Player game object while he is waiting to respawn.
I have a working player respawn system, but while the player is waiting to respawn his ghost body is still in the level.
Is there a way to turn off the rigidbody and mesh renderer until he respawns, or should I hide the body outside of the level?
I've read some of the other answers, and they involve destroying the player, then respawning him later. Would this be a good solution to explore?
Answer by AngryOldMan · Mar 05, 2011 at 01:43 AM
Yes I think the most effective method in games is to destroy your player and instantiate a "dead body" of your prefab (with animation preferably) which remains in level until you respawn. At which point you would destroy the instantiated "dead body". Another way is to hide it outside the level maybe by dropping it through the level and keeping the camera static, but this looks nasty and unprofessional. That's just my opinion, other people may see it differently?
I tend to agree with you though I've been told hiding a handful of GameObjects under the terrain is less CPU-expensive than Destroying/Instantiating... let's say the project is targeting iPhone/Android.
thats a very good point. Iv not looked into it myself but what I would suggest in this case would be to turn your character into a ragdoll on death. So you still die, still have no control over the character and the character's dead body is still in,without instantiating or destroying anything. http://unity3d.com/support/documentation/Components/wizard-RagdollWizard.html here's some info on it.
Thanks muchly. I implemented the destroy and instantiate later and it works great. Next is rag-dolling.
Your answer
Follow this Question
Related Questions
How to delay a respawn? 1 Answer
2D project - player respawn delay problem 0 Answers
Problem with enemy shooting 4 Answers
Player Respawn After Death 1 Answer
Respawning in UnityIphone? 2 Answers