Search Unity

Input string was not in a correct format

Discussion in 'Scripting' started by xKeiRx, Apr 30, 2017.

  1. xKeiRx

    xKeiRx

    Joined:
    May 25, 2016
    Posts:
    5
    System.Int64.Parse (System.String s)

    I don't know what's going on, because i didn't use "Parse" in this script. It was working in the previous version of Unity.


    https://pastebin.com/bD8Ve0Tg
     
  2. methos5k

    methos5k

    Joined:
    Aug 3, 2015
    Posts:
    8,712
    Convert.ToInt64 uses Parse internally; does the error appear from this line in the console?
    Is it possible that you don't have any data stored, and then when you go to retrieve the string, it's empty, and then you try to convert an empty string to an Int64 ? That can't be done..
    If you're still having this issue, try to give a default value in GetString (default date), or check if the string is empty, and don't try to convert unless it's got data..