private void SelectBackground() { string path = Application.dataPath + "/Data/SelectedItems.json"; string jsonString = File.ReadAllText(path); SettingsScript.SelectedItems it = JsonUtility.FromJson <SettingsScript.SelectedItems>(jsonString); for (int i = 0; i < it.item_entry_list.Count; i++) { // Debug.Log(it.item_entry_list[i].ToString()); switch (it.item_entry_list[i].name) { case "b1": GetComponent <SpriteRenderer>().sprite = sprite1; break; case "b2": GetComponent <SpriteRenderer>().sprite = sprite2; break; case "b3": GetComponent <SpriteRenderer>().sprite = sprite3; break; } } }
void GetColour() { string path = Application.dataPath + "/Data/SelectedItems.json"; string jsonString = File.ReadAllText(path); SettingsScript.SelectedItems it = JsonUtility.FromJson <SettingsScript.SelectedItems>(jsonString); //Debug.Log(it.item_entry_list.Count); for (int i = 0; i < it.item_entry_list.Count; i++) { switch (it.item_entry_list[i].name) { case "me1": // Debug.Log("RED"); r = true; break; case "me2": //blue //Debug.Log("BLUE"); b = true; break; case "me3": //green //Debug.Log("GREEN"); g = true; break; default: break; } } checkBooleans(); }