I can’t seem to find the problem of why it wont work, I can’t see problems in my code but all it does is change to “Ilan” and i can’t change it with HatNO
Here’s my code:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Hats : MonoBehaviour
{
public int HatNO;
public Sprite None;
public Sprite Kid;
public Sprite Becc;
public Sprite Lucy;
public Sprite Lucas;
public Sprite Jameson;
public Sprite Ilan;
void Update()
{
if(HatNO == 0);
{
this.gameObject.GetComponent<SpriteRenderer>().sprite = None;
Debug.Log("0");
}
if(HatNO == 1);
{
this.gameObject.GetComponent<SpriteRenderer>().sprite = Kid;
Debug.Log("1");
}
if(HatNO == 2);
{
this.gameObject.GetComponent<SpriteRenderer>().sprite = Becc;
Debug.Log("2");
}
if(HatNO == 3);
{
this.gameObject.GetComponent<SpriteRenderer>().sprite = Lucy;
Debug.Log("3");
}
if(HatNO == 4);
{
this.gameObject.GetComponent<SpriteRenderer>().sprite = Lucas;
Debug.Log("4");
}
if(HatNO == 5);
{
this.gameObject.GetComponent<SpriteRenderer>().sprite = Jameson;
Debug.Log("5");
}
if(HatNO == 6);
{
this.gameObject.GetComponent<SpriteRenderer>().sprite = Ilan;
Debug.Log("6");
}
}
}