I tried copying in runtime and pasting in editor, or using prefabutility.createprefab in runtime, but doesnt work, the joints are shown wrong, its not the same, for some reason the prefab is changing the data and joints are having differente connections and look totally different
The PrefabUtility class is not available at run time → that does work work for you.
Why do you need to copy data from the run time version ob a object?
Maybe there is a better way?
Mr Smart, it is available at runtime as it creates the prefab, just created wrong, same as copy paste
I need it cause i want to create a prefab that have the joints exactly in certain position
Maybe there is a better way, but noone says or know?
Runtime != in a build, so I assume you mean you want to create prefabs in the editor while the game is running?
If that’s the case, I wrote a tool to do this here as well. I used PrefabUtility.ReplacePrefab to replace the prefab I used to spawn the instance with the scene version of it. There is an option you need to set in that method (the 3rd parameter, which specifies the mode to save), which has to be set to connect to the prefab instance, otherwise it seems to do weird things to the linkages inside the object hierarchy.
If this isn’t the case though, and you are trying to save prefabs in a build, then that really won’t work, as the UnityEditor namespace is only available in the editor. For that you should just clone your object to somewhere in the game you can keep it (like as a child of an object marked to DontDestroyOnLoad) and disable it so it isn’t visible. Then use that object as your ‘prefab’ reference to spawn others.
Cheers
Yes, i dont mean the build, i mean at runtime in the editor. Ty for the tips, i will try that