private void CreateOrUpdateButton(AvatarCache.AvatarInfo info)
        {
            if (!info.IsValid)
            {
                return;
            }

            if (!_buttons.TryGetValue(info, out var element))
            {
                var frame = _controller.ContentFrame.Q("avatars");
                element = _controller.Assets.AvatarSelectorButton.InstantiateTemplate(frame);
            }

            void Clicked() => AvatarClicked(info);

            _buttons[info]        = element;
            element.style.display = DisplayStyle.Flex;

            element.Q <Button>().clickable = new Clickable(Clicked);
            element.Q("thumbnail").style.backgroundImage = info.Thumbnail;
            element.Q <Label>("header").text             = info.Name;
            element.Q <Label>("description").text        = info.Description;
            var ob = element.Q <ObjectField>("object-field");

            ob.objectType        = typeof(GameObject);
            ob.allowSceneObjects = true;
            ob.SetEnabled(false);
            ob.value = info.VrcAvatarDescriptor.gameObject;
            ob.RemoveObjectSelector();
            ob.Q(null, "unity-label").Display(false);
            ob.Q(null, "unity-object-field-display__label").Display(true);
        }
 private void OnAvatarWasUpdated(AvatarCache.AvatarInfo info)
 {
     if (ExpressionInfo.AvatarInfo == info)
     {
         UpdateMiniAvatar(ExpressionInfo);
         if (!info.IsValid)
         {
             var active = _history.Peek();
             if (active is Intro || active is AvatarSelection)
             {
                 return;
             }
             NavigateHistory(active);
         }
     }
 }
        private void OnAvatarWasUpdated(AvatarCache.AvatarInfo info)
        {
            if (!info.IsValid)
            {
                if (_buttons.TryGetValue(info, out var button))
                {
                    var frame = _controller.ContentFrame.Q("avatars");
                    frame.Remove(button);
                }

                _buttons.Remove(info);
                UpdateInfo();
                return;
            }
            CreateOrUpdateButton(info);
            UpdateInfo();
        }
 private void AvatarClicked(AvatarCache.AvatarInfo info)
 {
     _controller.ExpressionInfo.SetInfo(info);
     _controller.SetFrame <MainMenu>();
 }