void Update() { if (Manager.LocalAvatar != null) { var Textured = Manager.LocalAvatar.GetComponent <TexturedAvatar>(); if (Textured != null) { if (Textures != Textured.Textures) { Textures = Textured.Textures; while (Controls.Count < Textures.Count) { Controls.Add(GameObject.Instantiate(ControlPrefab, Container.transform).GetComponent <AvatarSkinMenuControl>()); } while (Controls.Count > Textures.Count) { Destroy(Controls[0].gameObject); Controls.RemoveAt(0); } for (int i = 0; i < Textures.Count; i++) { Controls[i].Bind(this, Textures.Get(i)); } } PreviewAvatar.Textures = Textured.Textures; PreviewAvatar.SetTexture(Textured.GetTexture()); } } }