输入字符串的格式不正确,已从JS转换为C#

在过去的几个小时中,我一直在绞尽脑汁,询问格式异常的位置和原因。我对C#还是很陌生,对JavaScript一无所知,所以当我将.js文件转换为c#时,我对更改的内容并不了解。该错误似乎与Parse语句有关,但我不知道如何解决。 “ dropboxurl”将是一个URL,但是出于明显的安全原因,我不能发布它:)。非常感谢。

using UnityEngine;
using System.Collections;
using System.IO;
using System;

public class Updater : MonoBehaviour
{

string latestVersionString = "randomText";      
float thisVersionFloat = 1.0f;                  
public string dropBoxLatestVersionTXT = "dropboxurl";
public bool updateAvailable;
float floatLatestVersionString;
float latestVersionFloat;
void Start()
{
    StartCoroutine(URL(dropBoxLatestVersionTXT));
}

IEnumerator URL(string dropBoxLatestVersionTXT)
{

    WWW www = new WWW(dropBoxLatestVersionTXT);
    yield return www;             



    latestVersionString = www.text;



    latestVersionFloat = 3.14159265358979f;  

    floatLatestVersionString = float.Parse(latestVersionString);

    latestVersionFloat = floatLatestVersionString;

    if (latestVersionFloat == thisVersionFloat)
    {
        Debug.Log("You have the latest version of the game");
        updateAvailable = false;
    }
    else if (latestVersionFloat > thisVersionFloat)
    {
        Debug.Log("You have outdated version of the game");
        updateAvailable = true;
    }
}

}

评论