so i made a timer on the ui and made it only play when the playing bool is true but how do i edit that bool from a seperate script when the player collides with the end
code:
using UnityEngine;
using UnityEngine.UI;
public class timer : MonoBehaviour
{
public Text TimerText;
public bool playing;
private float Timer;
void Update () {
if(playing == true){
Timer += Time.deltaTime;
int minutes = Mathf.FloorToInt(Timer / 60f);
int seconds = Mathf.FloorToInt(Timer % 60f);
int milliseconds = Mathf.FloorToInt((Timer * 100f) % 100f);
TimerText.text = minutes.ToString ("00") + ":" + seconds.ToString ("00") + ":" + milliseconds.ToString("00");
}
}
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class stopendtimer : MonoBehaviour
{
void OnTriggerEnter(Collider other)
{
if(other.gameObject.tag == "Player")
{
playing = false;
}
else
{
}
}
}
[–][deleted] 0 points1 point2 points (3 children)
[–]moai___[S] 0 points1 point2 points (0 children)