- Home /
Question by
monkeyThunk · Sep 04, 2014 at 01:33 PM ·
prefabsruntimesavingplaymode
Saving Runtime Generated GameObjects to Prefabs
I'm creating new instances of GameObjects while in Play Mode that I'd like to save in Prefabs. I can manually drag them from the hierarchy view into the Asset view while in Play mode, but I'd like to do this from a script that I trigger while still in Play mode.
Is that possible?
Comment
Answer by dsada · Sep 04, 2014 at 01:42 PM
This is all that you need:
http://docs.unity3d.com/ScriptReference/PrefabUtility.html
Take a look az CreatePrefab method
Dear @monkeyThunk! If you are satisfied than you can mark this answer as accepted and then the topic will get closed :)
Answer by daooo · Sep 18, 2019 at 03:17 AM
How can you save the mesh file? I use the same method but the saved prefab don't have the meshes.