public Coroutine AnimateFading() { float readoutScale = 0.0f; float targetScale = 1.0f; while (true) { if (hover.IsActive() && readoutScale < targetScale) { readoutScale = Math.Min(targetScale, readoutScale + Time.deltaTime); ViewObject.transform.localScale = readoutScale * DISPLAY_SCALE; ViewObject.SetActive(true); } if (!hover.IsActive() && readoutScale > 0.0f) { readoutScale = Math.Max(0.1f, readoutScale - Time.deltaTime); ViewObject.transform.localScale = readoutScale * DISPLAY_SCALE; if (readoutScale < 0.1f) { ViewObject.SetActive(false); readoutScale = 0.0f; } } yield return(0); } }