Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to Load. System.ArgumentNullException: Argument cannot be null. #107

Open
ginxx009 opened this issue Mar 7, 2018 · 0 comments
Open

Comments

@ginxx009
Copy link

ginxx009 commented Mar 7, 2018

Hello guys here's the full error on my logcat

Failed to Load.
System.ArgumentNullException: Argument cannot be null.
Parameter name: s
at System.IO.StringReader..ctor (System.String s) [0x00000] in :0
at (wrapper remoting-invoke-with-check) System.IO.StringReader:.ctor (string)
at LitJson.JsonReader..ctor (System.String json_text) [0x00000] in :0
at LitJson.JsonMapper.ToWrapper (LitJson.WrapperFactory factory, System.String json) [0x00000] in :0
at LitJson.JsonMapper.ToObject (System.String json) [0x00000] in :0
at StreetUtility.LoadJsonFromStreamingAssets (System.String path_with_extention_under_streaming_assets_folder) [0x00000] in :0
notice.json

Could someone help me please . And here's my code.
StreetUtility.cs

        string full_path = Path.Combine(Application.streamingAssetsPath, 
        path_with_extention_under_streaming_assets_folder);
        string result;

        if (full_path.Contains("://") || full_path.Contains(":///"))
        {
            WWW www = new WWW(full_path);
            while (!www.isDone) { }
            result = www.text;
        }
        else
        {
            result = File.ReadAllText(full_path);
        }
        Debug.Log("Loaded file: " + result);
        JsonData itemData = JsonMapper.ToObject(json);

and here is my LocalizationManager.cs

        string json = StreetUtility.LoadJsonFromStreamingAssets("notice.json");
        if (json != null)
        {
        LitJson.JsonData data = LitJson.JsonMapper.ToObject(json);
        json = data[language.ToString()].ToJson();
        Debug.LogError("PK DEBUG on Language.toString() : " + json.ToString());
        notice = LitJson.JsonMapper.ToObject<string[]>(json);
        Debug.LogError("PK DEBUG on Notice.toString : " + notice.ToString());

And here's my json file

{
"EN": [
"Cancel is available with Cancel button.",
"If you succeed in a lottery, you can receive additional rewards.",
"Round 2 and 3 are shorter than you think.",
"Please check the homepage in Confirm Game Method and Change Member Information."
],
"KR": [
"Cancel 버튼으로 배팅 취소가 가능합니다.",
"로또에 성공하면 추가적인 보상을 받을 수 있습니다.",
"라운드 2와 3은 생각보다 시간이 짧습니다.",
"게임 방법 확인 및 회원정보 변경은 홈페이지에서 확인해주세요."
],
"CN": [
"[中文] Cancel is available with Cancel button.",
"[中文] If you succeed in a lottery, you can receive additional rewards.",
"[中文] Round 2 and 3 are shorter than you think.",
"[中文] Please check the homepage in Confirm Game Method and Change Member Information."
],
"HK": [
"[广东话] Cancel is available with Cancel button.",
"[广东话] If you succeed in a lottery, you can receive additional rewards.",
"[广东话] Round 2 and 3 are shorter than you think.",
"[广东话] Please check the homepage in Confirm Game Method and Change Member Information."
]
}

Please can someone help me please.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant