i am a very beginner and i am learning c# for unity , plz see my code!
using UnityEngine;
using System.Collections;
public class HelloWorld : MonoBehaviour {
// Use this for initialization
public int troop = 5;
void LateUpdate()
{
if(troop > 0)
{
Debug.Log ("This is my first loop");
troop = troop - 1;
}
else
{
Debug.Log ("End of the loop");
}
}
}
it is printing “end of the loop” again and again! Plz tell me whats the problem ?