Hi im doing a train of thought clone (a game from the Luminosity apk). Now im trying to scripting the score system. whenerever you get a train collide with him respective house you gain a point. The problem is that when im debug.log the score is always 1 and dosnt gain +1. This is my piece of script. Sorry for my english
public int puntos;
// Use this for initialization
void Start ()
{
puntos = 0;
}
// Update is called once per frame
void Update ()
{
}
void OnTriggerEnter (Collider other)
{
if (other.gameObject.name == “RedTrain” && this.gameObject.name == “RedHouse”)
{
puntos += 1;
Debug.Log (puntos);
}
if (other.gameObject.name == “GreenTrain” && this.gameObject.name == “GreenHouse”)
{
puntos += 1;
Debug.Log (puntos);
}