I am creating a gameobject and changings its property while playing. For example I have a doll and I am changing her skin tone , hair style , eye color on playing and then I am saving it.
I want my gameobject to be saved. Whenever I quit my application and restart it , gameobject shouldnt lose its property.
I was saving the prefab, created on run time. It runs on editor, but not on device. Please help.
Following is the code I am using to save. (works only on Editor)
----------
## Code ##
public void SavePrefab () {
GameObject doll = this.gameObject ;
doll.name = "Barbie";
prefab = EditorUtility.CreateEmptyPrefab("Assets/Resources/" + Barbie + ".prefab");
//prefab = AssetDatabase.CreateAsset("Assets/Resources/" + Barbie + ".prefab");
EditorUtility.ReplacePrefab(Barbie, prefab);
prefab.name = "Barbie" ;
AssetDatabase.Refresh();
}
↧