// Coroutine used to fade the Cursor either in or out public static IEnumerator Fade(float newAlpha) { //// vars //// float cursFadeSpeed = GameProperties.CursFadeSpeed; //// work //// // fade the cursor's alpha from its current value to the new correct value if(CursAlpha < newAlpha) { for(float i = CursAlpha; i < newAlpha; i += Time.smoothDeltaTime * cursFadeSpeed) { CursAlpha = i; yield return null; } } else if(CursAlpha > newAlpha) { for(float i = CursAlpha; i > newAlpha; i -= Time.smoothDeltaTime * cursFadeSpeed) { CursAlpha = i; yield return null; } } // set the current alpha to the new alpha Debug.Log("test"); CursAlpha = newAlpha; }