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

I am getting this error when i try to parse a string to get float value.

$
0
0
FormatException: Input string was not in a correct format. System.Number.ParseSingle (System.String value, System.Globalization.NumberStyles options, System.Globalization.NumberFormatInfo numfmt) (at <1f0c1ef1ad524c38bbc5536809c46b48>:0) System.Single.Parse (System.String s, System.Globalization.NumberStyles style, System.Globalization.NumberFormatInfo info) (at <1f0c1ef1ad524c38bbc5536809c46b48>:0) System.Single.Parse (System.String s, System.IFormatProvider provider) (at <1f0c1ef1ad524c38bbc5536809c46b48>:0) STLReader+d__34.MoveNext () (at Assets/STLReader.cs:109) UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) (at C:/buildslave/unity/build/Runtime/Export/Scripting/Coroutines.cs:17) **Here is the script:** public Text ResultsBaseRes; float res=0; public void Create() { res = float. Parse(ResultsBaseRes.text); } **What I have already Tried?** changing the line to res = float.Parse(ResultsBaseRes.text, CultureInfo.CreateSpecificCulture("en-US")); res = float.Parse(ResultsBaseRes.text, CultureInfo.InvariantCulture.NumberFormat); res = float.Parse(ResultsBaseRes.text, CultureInfo.InvariantCulture); haven't gotten it to convert the string to float till now. i am using Unity 2019.1.8f1.

Viewing all articles
Browse latest Browse all 2891

Trending Articles



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