Hello everyone,
I have set a timer, it is working great but i cannot let it stop when user collides with another object.
Text text; float theTime;
public bool timer;
void Start()
{
text = GetComponent<Text>();
}
void Update()
{
if (timer == true)
{
theTime += Time.deltaTime;
string seconds = (theTime % 60).ToString("0");
text.text = seconds;
}
}
}
How may I give reference to another script to call these methods when user OnColliderEnter2D method ?
I have tried calling reference methods on internet but did not work.
Thank you very much for your help.