// Use this for initialization void Awake() { custom_controller = this; foodController = GetComponent <FoodController> (); AlphabetChoices = new List <GameObject> (); AlphabetChoices.Add(aAnswer); AlphabetChoices.Add(bAnswer); AlphabetChoices.Add(cAnswer); AlphabetChoices.Add(dAnswer); CustomCoin = data.CustomFood; // CustomQuestions = new List<QuestionObject> (GetComponent<CreateCustomQuestions> ().CustomQuestions); // print(DataManager.control.questions.questions); if (DataManager.control == null) { CustomQuestions = new List <QuestionObject> (GetComponent <CreateCustomQuestions> ().CustomQuestions); print("why: " + DataManager.control); } else { if (DataManager.control.questions.questions != null) { if (DataManager.control.questions.questions.Count == 0 || DataManager.control.questions.questions.Count == 1) { CustomQuestions = new List <QuestionObject> (GetComponent <CreateCustomQuestions> ().CustomQuestions); } else { for (int i = 0; i < DataManager.control.questions.questions.Count; i++) { QuestionObject temp = new QuestionObject(); temp.Restore(DataManager.control.questions.questions [i]); CustomQuestions.Add(temp); } } } else { CustomQuestions = new List <QuestionObject> (GetComponent <CreateCustomQuestions> ().CustomQuestions); } // print (DataManager.control); } }