Hello,
I have my playersLives variable setup in gameController, after player crashes with object text pops up with updated amount of playerLives. Now I wanted to go step further and display images hearts, so i got free gui asset with heart images but how would i add those images to my working playerLives variable ?
Thank You.
you would separate the image of the red heart from the background so you can display them independently on top of the background.
then do something like this:
public int lives = 5;
public Texture2D heart;
void Start () {
if(heart==null){heart= new Texture2D(1,1);}}
void OnGUI(){
float space;
int ii=lives;
space =40;
while(ii>0){ii--;GUI.DrawTexture(new Rect(space,20,30,30),heart);
space+=35;}}