This is the script:
using UnityEngine;
using System;
public class DataTranslator : MonoBehaviour
{
private static string KILL_SYMBOL = "[KILLS]";
private static string DEATHS_SYMBOL = "[DEATHS]";
public static int DataToKills(string data)
{
return int.Parse (DataToValue(data, KILL_SYMBOL));
}
public static int DataToDeaths(string data)
{
return int.Parse (DataToValue(data, DEATHS_SYMBOL));
}
public static int DataToValue(string data, string symbol)
{
string[] pieces = data.Split('/');
foreach (string piece in pieces)
{
if (piece.StartsWith(symbol))
{
return piece.Substring(symbol.Length);
}
}
Debug.LogError(symbol + "not found in" + data);
return "";
}
}
And this are the error:
- Assets/DataTranslator.cs(17,20): error CS1502: The best overloaded method match for `int.Parse(string)’ has some invalid arguments
2)Assets/DataTranslator.cs(11,28): error CS1503: Argument #1' cannot convert
int’ expression to type `string’
- Assets/DataTranslator.cs(17,20): error CS1502: The best overloaded method match for `int.Parse(string)’ has some invalid arguments
4)Assets/DataTranslator.cs(17,27): error CS1503: Argument #1' cannot convert
int’ expression to type `string’
5)Assets/DataTranslator.cs(28,30): error CS0029: Cannot implicitly convert type string' to
int’
- Assets/DataTranslator.cs(33,16): error CS0029: Cannot implicitly convert type
string' to
int’
i can’t understand where is the error