From 2064c853becb46f48ceaea64d523ed9842dc1808 Mon Sep 17 00:00:00 2001 From: chrisgregan Date: Wed, 25 Jun 2014 09:59:34 +0100 Subject: [PATCH] Fixed child sprites not fading in some cases --- Assets/Fungus/Scripts/SpriteFader.cs | 24 +++++++++++----------- Assets/FungusExample/Scenes/Example.unity | Bin 95616 -> 95752 bytes 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Assets/Fungus/Scripts/SpriteFader.cs b/Assets/Fungus/Scripts/SpriteFader.cs index 20f867f7..f3864b24 100644 --- a/Assets/Fungus/Scripts/SpriteFader.cs +++ b/Assets/Fungus/Scripts/SpriteFader.cs @@ -30,6 +30,18 @@ namespace Fungus return; } + // Fade child sprite renderers + SpriteRenderer[] children = spriteRenderer.gameObject.GetComponentsInChildren(); + foreach (SpriteRenderer child in children) + { + if (child == spriteRenderer) + { + continue; + } + + FadeSprite(child, targetColor, duration, slideOffset); + } + // Destroy any existing fader component SpriteFader oldSpriteFader = spriteRenderer.GetComponent(); { @@ -50,18 +62,6 @@ namespace Fungus spriteFader.endColor = targetColor; spriteFader.endPosition = spriteRenderer.transform.position; spriteFader.slideOffset = slideOffset; - - // Fade child sprite renderers - SpriteRenderer[] children = spriteRenderer.gameObject.GetComponentsInChildren(); - foreach (SpriteRenderer child in children) - { - if (child == spriteRenderer) - { - continue; - } - - FadeSprite(child, targetColor, duration, slideOffset); - } } void Start() diff --git a/Assets/FungusExample/Scenes/Example.unity b/Assets/FungusExample/Scenes/Example.unity index 90db1f79881f1a09a4e7fb833cf60bac311e82db..caec8d76ade382d01c508d4ededc05ec9d4e60fb 100644 GIT binary patch delta 2065 zcmZA1TTEP46oBD%1e!tG6ziB&qY*8nl+gxjh3N&sq%>2MYmpAMr9-(5NvQ)VEnw*o ztr4_V;xWFpA<+jO430qy`b4xE9#lqwgqTu^Rzt50SWML-{%7VKvX2jYF5m36*V=3E zIbGKix^E;TiLV{#*ESw) z*wa+qP^XVtmU&GlNJ{2;F%Q)7=~j;B|01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