Hi! I’m creating an editor where the player can put parts together to make a vehicle. I want to save it like a prefab so individual parts can be destroyed. I need to save it so the player can reuse or edit it at any time. I read that it’s not possible to make a prefab at runtime so what other options are there?
-Thanks
It’s perfectly possible to create a prefab at runtime, but not if it’s a stand-along build.
For a stand-alone build, you just need some sort iof identification system. Make all seperate parts prefabs and load them into a list or array, or dictionary. Your vehicle base gameobject then needs to hold a reference to the parts; strings so you can reference their name, for example. Once these references are filled, you just create the vehicle from the referenced parts as you normally would, with Instantiate(). Now you just need to save the class holding the references.