Quantcast
Channel: Questions in topic: "error message"
Viewing all articles
Browse latest Browse all 2891

Trying to read out of a website and wan't to store the value. Works perfect in Unity and Desktop Build. Any Ideas?

$
0
0
Error Code: FormatException: Input string was not in the correct format. I got the string from the website and converted it to a float (theres just a single value on the website). It works in Unity and in Desktop build, but just not on WebGL. My Script: using System.Collections; using System.Collections.Generic; using UnityEngine; public class DataLoader : MonoBehaviour { private int steps; private string stepsString; public int whileNumber = 1; private float kilometers; private float stepsFloat; // Use this for initialization IEnumerator Start () { while (whileNumber == 1) { WWW databaseSteps = new WWW("http://schrittzaehler.rapperswil-jona.ch/globalsteps.php"); yield return databaseSteps; stepsString = databaseSteps.text; steps = int.Parse(stepsString); stepsFloat = steps; kilometers = stepsFloat * 0.62f / 1000; PlayerPrefs.SetFloat("kilometersTravelled", kilometers); Debug.Log(kilometers); yield return new WaitForSeconds(1); } } // Update is called once per frame void Update () { } }

Viewing all articles
Browse latest Browse all 2891

Trending Articles



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