and the error is most likely between the keyboard and the chair.
Now, I have been making a 2D game for the past few days, trying to learn the engine and get to know the programming. Eventually I needed to make a trigger area which on entrance by the player starts a timer. I have followed one of the videos about physics and I believe, that I did everything right, but you know how it goes…
My character has a rigidbody and a colider, I have tried making another collider on it as a trigger, didn’t work. My other object is static, has a collider set as trigger and has the script attached.
Here is the code
`using UnityEngine;
using System.Collections;
public class startingLine : MonoBehaviour {
[HideInInspector]
public float timer = 0f;
[HideInInspector]
public bool timerStart = false;
void OnTriggerEnter(Collider other)
{
// if (!timerStart)
Debug.Log ("lul");
timerStart = true;
/*else {
timer=0;
timerStart = false;
}*/
}
// Use this for initialization
void Start () {
}
// Update is called once per frame
void FixedUpdate () {
if (timerStart) {
timer++;
Debug.Log (timer);
}
}
}
`
Help?