- Home /
Respawn with damage nwh
Hi everyone,
I'm working on a racing game that uses NWH vehicle physics. I have the damage feature enabled which basically uses mesh deformation and lowers engine performance on collision. This is an excellent feature which has worked quite well so far; but now I want to save that damage and respawn the vehicle like that in the next scene (or in the garage until the player chooses to fix the car). I do not know how to do this. Any ideas would be appreciated.
Extra info: - Currently I have a script which spawns the car from the prefabs folder. - Damage of the car currently only lasts till the end of the race or until player respawns.
Thanks all for your help, I would upload some script but I am unsure on where to start with this issue.
Answer by Hristo_Kalinov · May 18, 2020 at 10:59 AM
You can save the car Object as a new prefab and spawn that car instead of the repaired one. https://docs.unity3d.com/ScriptReference/PrefabUtility.html?_ga=2.208331026.18034221.1589797824-624716945.1589797824
I hope this was helpful
The PrefabUtility
class is part of the UnityEditor
namespace, which can't be used in a built game
Your answer
Follow this Question
Related Questions
Racing Game: Saving and loading replay data? 1 Answer
Car Collision Damage 1 Answer
vehicle falls through the ground 1 Answer
[C#] Vehicle Controller Acting Very Jittery? 0 Answers
How to make car damage like in gta 4 3 Answers