- Home /
Edit Prefab ingame and save them
Hi,
I want to create a tuningsystem for cars in my game only with enabling and disabling components of a carprefab which spawns in every scene. I dont know where I need to specify the path of the components from the prefab and where i need to say which component will be enabled/disabled and how to save the changes ingame...
Thx for every answer :)
Answer by DiegoSLTS · Sep 04, 2015 at 02:54 AM
I think you can't edit prefabs ingame, you can edit them with a custom editor in Unity's editor, using the PrefabUtility class: http://docs.unity3d.com/ScriptReference/PrefabUtility.html
What you want to do sounds like a customization. You should write some scripts that knows the different parts of the prefab that can be disabled, then instead of saving the prefab, save a text file that contains the state of each part of the prefab (a simple boolean value for the IsActive property). When you show that prefab in a new scene, load that text file and turn on or off the different parts according to what the file says.
Your answer
Follow this Question
Related Questions
Reinitialize prefab 0 Answers
using Contains(gameObject) to find and destroy a gameObject from a list 2 Answers
Object spawns itself instead of it's prefab. 3 Answers
Access a child from the parent or other gameObject. 2 Answers
Game object not falling 1 Answer