public static string ReadAllText(string p_fullPathWithFileName) { string v_return = ""; try { string v_fileNameWithoutExtension = KiltUtils.GetFileName(p_fullPathWithFileName, false); string v_resultPath = p_fullPathWithFileName; string v_folderPath = v_resultPath.Replace(KiltUtils.GetFileName(p_fullPathWithFileName, true), ""); string v_resourcesPath = KiltUtils.PathCombine(v_folderPath, v_fileNameWithoutExtension); v_resourcesPath = KiltUtils.PathUncombine(v_resourcesPath, KiltUtils.GetCurrentDataPath()); //Try Resources.Load if (string.IsNullOrEmpty(v_return)) { TextAsset v_textAsset = Resources.Load(v_resourcesPath, typeof(TextAsset)) as TextAsset; if (v_textAsset != null && !string.IsNullOrEmpty(v_textAsset.text)) { v_return = v_textAsset.text; } ; } //Try Traditional Methods #if UNITY_WEBPLAYER && !UNITY_EDITOR if (string.IsNullOrEmpty(v_return)) { string v_textObject = ReadAllTextFromPlayerPrefs(v_resourcesPath); if (!string.IsNullOrEmpty(v_textObject)) { v_return = v_textObject; } } #elif UNITY_WEBPLAYER && UNITY_EDITOR if (string.IsNullOrEmpty(v_return) && KiltUtils.CallEditorStaticFunctionWithReturn <bool>("SystemIOEditorWebPlayer", "FileExists", v_resultPath)) { string v_textObject = KiltUtils.CallEditorStaticFunctionWithReturn <string>("SystemIOEditorWebPlayer", "ReadAllText", v_resultPath); if (!string.IsNullOrEmpty(v_textObject)) { v_return = v_textObject; } } #elif !UNITY_WEBPLAYER if (string.IsNullOrEmpty(v_return) && System.IO.File.Exists(v_resultPath)) { string v_textObject = File.ReadAllText(v_resultPath); if (!string.IsNullOrEmpty(v_textObject)) { v_return = v_textObject; } } #endif } catch {} return(v_return); }