コード例 #1
0
        public static string LoadTextFromStreamingAssets(string path)
        {
            if (!IsStreamingAssetsExists(path))
            {
                throw new Exception("Not exist StreamingAssets path: " + path);
            }

#if UNITY_ANDROID
            return(ResAndroidPlugin.GetAssetString(path));
#else
            return(File.ReadAllText(Path.Combine(Application.streamingAssetsPath, path)));
#endif
        }
コード例 #2
0
        public static string ReadAllText(string path)
        {
            string fullPath;
            var    getResPathType = GetBundleFullPath(path, out fullPath);

            if (getResPathType == ResPathType.Invalid)
            {
                return(null);
            }

#if UNITY_ANDROID
            if (getResPathType == ResPathType.InApp)
            {
                return(ResAndroidPlugin.GetAssetString(path));
            }
#endif
            return(File.ReadAllText(fullPath));
        }