Quantcast
Channel: Questions in topic: "javascipt"
Viewing all articles
Browse latest Browse all 1875

Cannot convert 'String' to 'float'. Making a stop watch

$
0
0
Hi all i have problem as it displays me this Cannot convert 'String' to 'float'. Im trying to make a timer, when i add 30 seconds it will add 30 to float, but have it in format so its minutes and seconds, if i dont format then instead showing 1 : 20 [1 minute 20 seconds] it shows 80. Heres my code public var startTime : float; public var minutes : int; public var seconds : int; public var textField : UI.Text; public var timerIsActive : boolean = false; function Start() { textField = GetComponent(UI.Text); } function Update () { textField.text = startTime.ToString(); startTime = String.Format ("{0:00}:{1:00}", minutes, seconds); } I been trying to figure out and was googling ideas and all for hour or even more but just gave up can't find anything. Would really appreciate if someone could help. Thanks !

Viewing all articles
Browse latest Browse all 1875

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>