Question by
Renarts_ · Aug 14, 2017 at 05:42 PM ·
scripting problemnot workingscript error
can't change float value from OnTriggerEnter
code when i go in collider Debug shows the text but time is not added :p
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class LevelTimer : MonoBehaviour {
public Text text;
public float timeLeft = 30.0f;
void OnTriggerEnter(Collider other) {
timeLeft += 10f;
Debug.Log("hit?");
}
void Update()
{
timeLeft -= Time.deltaTime;
text.text = timeLeft.ToString("0");
if(timeLeft < 0)
{
}
}
}
Comment
Answer by fiterpilot · Aug 15, 2017 at 12:27 AM
Is the time changing on the script just not visually in game?? If so try removing the "0" in .ToString();
Your answer
Follow this Question
Related Questions
I can't build my project, how can I fix it? 3 Answers
Script not recognizing or detecting Photon functions? 0 Answers
On button down animation plays 1 Answer
stealth Frezz when "hit" play bttn 0 Answers