I'm tracking down an issue (probably unique to our game) where once in a long while, there will be a single frame where the NPC portrait is not set to anything and shows a big white rectangle. I thought maybe when I got rid of this, it caused the issue. Just curious if that could be.
Code: Select all
protected virtual IEnumerator SetAnimatorAtEndOfFrame(RuntimeAnimatorController animatorController)
{
if (animator.runtimeAnimatorController != animatorController)
{
animator.runtimeAnimatorController = animatorController;
}
if (animatorController != null)
{
Tools.SetGameObjectActive(portraitImage, portraitImage.sprite != null);
}
yield return new WaitForEndOfFrame();
if (animator.runtimeAnimatorController != animatorController)
{
animator.runtimeAnimatorController = animatorController;
}
if (animatorController != null)
{
Tools.SetGameObjectActive(portraitImage, portraitImage.sprite != null);
}
}