private IEnumerator loadRenderGameObjects(DCustomEquipment[] outfit, Color bodyColor, AvatarAnimationFrame avatarFrame, RenderRequest renderRequest)
        {
            if (avatarPrefab == null && isLoadingAvatarPrefab)
            {
                yield return(null);
            }
            if (avatarPrefab == null)
            {
                isLoadingAvatarPrefab = true;
                AssetRequest <GameObject> assetRequest = null;
                try
                {
                    assetRequest = Content.LoadAsync(uiAvatarPrefabContentKey);
                }
                catch (Exception ex)
                {
                    Log.LogError(this, $"Could not load UI Avatar penguin asset {uiAvatarPrefabContentKey.Key}. Message: {ex.Message}");
                }
                if (assetRequest != null)
                {
                    yield return(assetRequest);

                    avatarPrefab          = assetRequest.Asset;
                    isLoadingAvatarPrefab = false;
                }
            }
            if (avatarPrefab != null)
            {
                GameObject            avatarInstance = UnityEngine.Object.Instantiate(avatarPrefab);
                IconRenderLightingRig lightingRig    = IconRenderLightingRig.Acquire();
                while (!lightingRig.IsReady)
                {
                    yield return(null);
                }
                DCustomOutfit avatarOutfit = default(DCustomOutfit);
                avatarOutfit.Equipment = outfit;
                AvatarModel avatarModel = avatarInstance.GetComponent <AvatarModel>();
                yield return(AvatarRenderer.RenderOutfit(avatarOutfit, avatarModel.BeakColor, bodyColor, avatarModel.BellyColor, imageBuilderCameraData, avatarInstance, (ModelRenderer modelRenderer) => onProcessAnimationFrame(modelRenderer, renderRequest.Handle, avatarInstance), avatarFrame));

                IconRenderLightingRig.Release();
            }
            else
            {
                Log.LogErrorFormatted(this, "Unabe to load the UI Avatar Prefab at path {0}", uiAvatarPrefabContentKey.Key);
            }
        }
예제 #2
0
 private void OnEnable()
 {
     lightingRig = IconRenderLightingRig.Acquire();
 }