The problem is this:
Code: Select all
private void OnGUI()//
{
if (GUILayout.Button("Add cat"))//①press 1 time
{
GenerateText(0);
}
if (GUILayout.Button("Add dog"))//①press 1 time
{
GenerateText(1);
}
if (GUILayout.Button("Save"))//②press //③Stop and replay
{
Save();
}
if (GUILayout.Button("Load"))//④press
{
Load();//After reading, the Text font will disappear, you can click on the object of the level panel to see related information
}
}
private void GenerateText(int id)
{
GameObject textGO = Instantiate(prefabList[id],transform); //public List<GameObject> prefabList;
textGOList.Add(textGO);// public List<GameObject> textGOList;
}
private void Save()
{
ES3.Save("textGOList",textGOList);
}
private void Load()
{
textGOList = ES3.Load<List<GameObject>>("textGOList");
}