From c0667c824f5c55a420c51a2831ad05939c889954 Mon Sep 17 00:00:00 2001 From: Steve Halliwell Date: Fri, 21 Jun 2019 17:20:15 +1000 Subject: [PATCH] Portrait 2019 fix (#743) Use overrideSprite instead of sprite on UIImages --- Assets/Fungus/Scripts/Components/PortraitController.cs | 10 +++++----- Assets/Fungus/Scripts/Components/SayDialog.cs | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Assets/Fungus/Scripts/Components/PortraitController.cs b/Assets/Fungus/Scripts/Components/PortraitController.cs index 1f58d155..20b7324d 100644 --- a/Assets/Fungus/Scripts/Components/PortraitController.cs +++ b/Assets/Fungus/Scripts/Components/PortraitController.cs @@ -196,7 +196,7 @@ namespace Fungus // Configure the portrait image Image portraitImage = portraitObj.GetComponent(); portraitImage.preserveAspect = true; - portraitImage.sprite = character.ProfileSprite; + portraitImage.overrideSprite = character.ProfileSprite; portraitImage.color = new Color(1f, 1f, 1f, 0f); // LeanTween doesn't handle 0 duration properly @@ -455,7 +455,7 @@ namespace Fungus float duration = (options.fadeDuration > 0f) ? options.fadeDuration : float.Epsilon; // Fade out a duplicate of the existing portrait image - if (options.character.State.portraitImage != null && options.character.State.portraitImage.sprite != null) + if (options.character.State.portraitImage != null && options.character.State.portraitImage.overrideSprite != null) { GameObject tempGO = GameObject.Instantiate(options.character.State.portraitImage.gameObject); tempGO.transform.SetParent(options.character.State.portraitImage.transform, false); @@ -463,7 +463,7 @@ namespace Fungus tempGO.transform.localScale = options.character.State.position.localScale; Image tempImage = tempGO.GetComponent(); - tempImage.sprite = options.character.State.portraitImage.sprite; + tempImage.overrideSprite = options.character.State.portraitImage.overrideSprite; tempImage.preserveAspect = true; tempImage.color = options.character.State.portraitImage.color; @@ -473,10 +473,10 @@ namespace Fungus } // Fade in the new sprite image - if (options.character.State.portraitImage.sprite != options.portrait || + if (options.character.State.portraitImage.overrideSprite != options.portrait || options.character.State.portraitImage.color.a < 1f) { - options.character.State.portraitImage.sprite = options.portrait; + options.character.State.portraitImage.overrideSprite = options.portrait; options.character.State.portraitImage.color = new Color(1f, 1f, 1f, 0f); LeanTween.alpha(options.character.State.portraitImage.rectTransform, 1f, duration).setEase(stage.FadeEaseType).setRecursive(false); } diff --git a/Assets/Fungus/Scripts/Components/SayDialog.cs b/Assets/Fungus/Scripts/Components/SayDialog.cs index afdd1e9b..1ccb7832 100644 --- a/Assets/Fungus/Scripts/Components/SayDialog.cs +++ b/Assets/Fungus/Scripts/Components/SayDialog.cs @@ -394,7 +394,7 @@ namespace Fungus if (image != null) { - characterImage.sprite = image; + characterImage.overrideSprite = image; characterImage.gameObject.SetActive(true); currentCharacterImage = image; }