txtDebug - компонент Text на канвасе - что то типо консоли
Синтаксис:
Используется csharp
using Newtonsoft.Json;
using System.Collections.Generic;
using System.IO;
using UnityEngine;
using UnityEngine.UI;
public class IOFilesController : MonoBehaviour
{
public static Dictionary<string, string> GetDictionaryFromFile(string culture)
{
Dictionary<string, string> CurrentCultureDictionary = new Dictionary<string, string>();
Text txtDebug = GameObject.Find("MainCanvas").GetComponentInChildren<Text>();
txtDebug.text += "before string readstring \r\n";
#if UNITY_EDITOR
string readstring = File.ReadAllText(Application.dataPath + "/Resources/Files/DictionaryLocalisation." + culture);
txtDebug.text += "after unity string readstring = File.ReadAllText \r\n";
#elif UNITY_ANDROID
WWW reader = new WWW(Application.dataPath + "/Resources/Files/DictionaryLocalisation." + culture);
txtDebug.text += "after WWW reader = new WWW \r\n"; - это выводит
while (!reader.isDone) { }
txtDebug.text += "after while (!reader.isDone) \r\n"; - это выводит
string readstring = reader.text;
txtDebug.text += "after string readstring = reader.text; \r\n";- это выводит
txtDebug.text += readstring;
txtDebug.text += "after txtDebug.text +=readstring;" - не выводит!
#endif
txtDebug.text += "after #endif \r\n";
txtDebug.text += readstring;
CurrentCultureDictionary = JsonConvert.DeserializeObject<Dictionary<string, string>>(readstring);
txtDebug.text += "after CurrentCultureDictionary = JsonConvert \r\n";
Debug.Log("Загружен словарь : " + Application.dataPath + "/Resources/Files/DictionaryLocalisation." + culture);
txtDebug.text += "Загружен словарь : " + Application.dataPath + "/Resources/Files/DictionaryLocalisation." + culture;
return CurrentCultureDictionary;
}
}
using System.Collections.Generic;
using System.IO;
using UnityEngine;
using UnityEngine.UI;
public class IOFilesController : MonoBehaviour
{
public static Dictionary<string, string> GetDictionaryFromFile(string culture)
{
Dictionary<string, string> CurrentCultureDictionary = new Dictionary<string, string>();
Text txtDebug = GameObject.Find("MainCanvas").GetComponentInChildren<Text>();
txtDebug.text += "before string readstring \r\n";
#if UNITY_EDITOR
string readstring = File.ReadAllText(Application.dataPath + "/Resources/Files/DictionaryLocalisation." + culture);
txtDebug.text += "after unity string readstring = File.ReadAllText \r\n";
#elif UNITY_ANDROID
WWW reader = new WWW(Application.dataPath + "/Resources/Files/DictionaryLocalisation." + culture);
txtDebug.text += "after WWW reader = new WWW \r\n"; - это выводит
while (!reader.isDone) { }
txtDebug.text += "after while (!reader.isDone) \r\n"; - это выводит
string readstring = reader.text;
txtDebug.text += "after string readstring = reader.text; \r\n";- это выводит
txtDebug.text += readstring;
txtDebug.text += "after txtDebug.text +=readstring;" - не выводит!
#endif
txtDebug.text += "after #endif \r\n";
txtDebug.text += readstring;
CurrentCultureDictionary = JsonConvert.DeserializeObject<Dictionary<string, string>>(readstring);
txtDebug.text += "after CurrentCultureDictionary = JsonConvert \r\n";
Debug.Log("Загружен словарь : " + Application.dataPath + "/Resources/Files/DictionaryLocalisation." + culture);
txtDebug.text += "Загружен словарь : " + Application.dataPath + "/Resources/Files/DictionaryLocalisation." + culture;
return CurrentCultureDictionary;
}
}
в юнити все без проблем - проходит весь код.
в андроиде что то никак неполучается, 4 часа долблюсь никак непойму
признаки:
андроид тонет уже на строке txtDebug.text += readstring; (тонет - это не значит -вылетает )
txtDebug.text += "after string readstring = reader.text; \r\n"; - это еще печатает(строка выше)
прошу совета