public void SaveMyData() { if (weight_text != null) { tmp_weight = float.Parse(weight_text.GetComponent <Text>().text); } //increase size +1 entry size = size + 1; //save all values in tmp_actor all_actors[size] = setActorValuesToSave(); //create and add values to List that will be saved in separate file "actors.xml" ActorContainer actorCollection = new ActorContainer(); //actorCollection.actors.Add(all_actors[size]); foreach (Actor loop_actor in all_actors) { actorCollection.actors.Add(loop_actor); } actorCollection.Save(path); Debug.Log("new Entry was successfull saved!"); userCreated = true; }
void Start() { firstLogin = false; if (Application.loadedLevel == 18) { } else { if (!System.IO.File.Exists(path)) { System.IO.File.Create(path).Dispose(); Actor tmp = new Actor(); tmp.id = 000; tmp.name = "reserved"; tmp.gender = 0; ActorContainer actorCollection = new ActorContainer(); actorCollection.actors.Add(tmp); actorCollection.Save(path); } UpdateSize(); if (size == 0) { Actor tmp = new Actor(); tmp.id = 000; tmp.name = "reserved"; tmp.gender = 0; all_actors[0] = tmp; } } }