Example #1
0
        private void OnAvatarReceived(IConnectedPlayer player, CustomAvatarData avatar)
        {
            if (player.userId != _connectedPlayer.userId)
            {
                return;
            }

            if (avatar == null)
            {
                return;
            }

            if (avatar.hash == new CustomAvatarData().hash)
            {
                return;
            }

            avatarData = avatar;
            _avatarProvider.FetchAvatarByHash(avatar.hash, CancellationToken.None).ContinueWith(a =>
            {
                if (!a.IsFaulted && a.Result is AvatarPrefab)
                {
                    HMMainThreadDispatcher.instance.Enqueue(() =>
                    {
                        CreateAvatar(a.Result);
                    });
                }
            });
        }