How can I save and load datas from multiple objects, that uses different variables from same script?Question (self.Unity3D)
I am making a strategy game and i there are a few resources, for exampla wood and paper. I have a script called "kaynaklar" (means resources) and this script has variables for wood and paper. It has a switch and with putting in a string with inspector you choose the resource that you use. So basically I am using same script for every different text (which are showing the amount of resource) with choosing the variable that i want with typing it's name, you can see better in code:
public class kaynaklar: MonoBehaviour { private int tahta; //wood private int kagit; //paper
void Start()
{ switch (kaynakTur) { case "Tahta": tahta = buKaynak; //buKaynak is the variable i use from
other scripts break;
case "Kagit":
kagit = buKaynak;
break;}
}
So basically I need to save those datas and load them again. I managed to create an array in this script that holds the current values of all resources (there are 8 of them), but i could not use it in my saving script. Thanks in advance for your help.
Your answer
Follow this Question
Related Questions
Having a bit of a problem with loading a save file. 0 Answers
How to save player score? (C#) 0 Answers
Save and load whole scene 2 Answers
Saving data from multiple game objects 1 Answer
How can I save level progression 1 Answer