void OnGUI() { if (Application.loadedLevelName == "LoadingScreen") { } else if (Application.loadedLevelName == "MainMenu") { } else { displayHUD = true; } if (displayHUD) { currentLife = livesControllerScript.getLife(); if (currentLife > 0) { Rect posRect = new Rect(5, 5, heartTextureWidth / x * currentLife, heartTextureHeight); Rect texRect = new Rect(0f, 0f, j / y * currentLife, i); GUI.DrawTextureWithTexCoords(posRect, hearts, texRect); } } }