// Use this for initialization void Start() { if (Instance == null) { Instance = this; DontDestroyOnLoad(transform.gameObject); } else { Destroy(this.gameObject); } }
// Use this for initialization void Start() { //avatarIndex = GameManager.Instance.myPlayerData.GetAvatarIndex(); staticController = GameObject.Find("StaticGameVariablesContainer").GetComponent <StaticGameVariablesController>(); changeName.GetComponent <InputField>().text = GameManager.Instance.nameMy; if (GameManager.Instance.facebookAvatar != null) { GameObject button = Instantiate(buttonPrefab); button.GetComponent <ProfilePictureController>().picture.GetComponent <Image>().sprite = GameManager.Instance.facebookAvatar; button.transform.SetParent(gridView.transform, false); GameObject border = button.GetComponent <ProfilePictureController>().frame; //if (GameManager.Instance.myPlayerData.GetAvatarIndex().Equals("fb")) //{ border.GetComponent <Image>().color = Color.green; //} string index = "fb"; button.GetComponent <Button>().onClick.RemoveAllListeners(); button.GetComponent <Button>().onClick.AddListener(() => ClickButton(index, border)); buttons.Add(border); } for (int i = 0; i < staticController.avatars.Length; i++) { GameObject button = Instantiate(buttonPrefab); button.GetComponent <ProfilePictureController>().picture.GetComponent <RawImage>().texture = UserDetailsManager.userImageTexture; button.transform.SetParent(gridView.transform, false); GameObject border = button.GetComponent <ProfilePictureController>().frame; //if (GameManager.Instance.myPlayerData.GetAvatarIndex().Equals(i + "")) // { border.GetComponent <Image>().color = Color.green; //} string index = "" + i; button.GetComponent <Button>().onClick.RemoveAllListeners(); button.GetComponent <Button>().onClick.AddListener(() => ClickButton(index, border)); buttons.Add(border); } }