How would one proceed to retrieve the original prefab used for instantiating an object?
In the editor these two functions work :
But I need something that works in the release version.
I have objects that can be transported between scenes ands I need to save their data and original prefab to be able to instantiate them outside of the scene they have been originally instantiated.
- Game designers create new prefabs.
- Game designers create objects from prefabs and place them in scenes (50 to 150 scenes).
- Game is played and objects are moved across scenes.
- Game is saved and infos about objects which have moved are saved in the save streams (files or network).
This is where I got stuck. Currently, to palliate to the shortcomings, we're saving the name of the prefab in the prefab. But each time a prefab is moved, renamed or duplicated the string must be changed too, sometimes the objects created from the prefab keep the original name (game designer might have edited the prefabPath field).
Maybe there is a better way to achieve proper save games without having to access to the original prefab/name. But currently we keep the saves segmented on a per level basis (easier and safer to save/load to files and transfer the save games to/from servers)