!Hi, i have some mini project which it makes some increment and decreasement in it.
so i make a button to make a soldier increase and decrease by pressing plus and min button.
however , it didn’t work , i try to debug but nothing happens.
so maybe a void cannot using if statement ?
please make it clear for me . thanks !
this the script i use:
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
using UnityEngine.SceneManagement;
public class CastleGo : MonoBehaviour {
public Text curInfantQty;
public Text curArchQty;
public Text curCavQty;
public int curInfant;
public int curArch;
public int curCav;
// Use this for initialization
void Start () {
curInfant = CastleQty.infantryQty;
curInfantQty.text = "" + curInfant;
curArchQty.text = "" + CastleQty.archerQty;
curCavQty.text = "" + CastleQty.cavalryQty;
}
public void plusInfant()
{
if (curInfant > CastleQty.infantryQty) {
curInfant++;
Debug.Log (curInfant);
} else {
return;
}
}
public void minInfant()
{
if (curInfant <= 0) {
curInfant--;
Debug.Log (curInfant);
} else {
return;
}
}
}
and the button i wish to make simply like this:
i already doing my stuff with the button setting like attach it to the script.
still didn’t figure it out.