unity获取android本地的文件,Unity中C# 文件本地读取,本地保存等实例

using UnityEngine;

using System.Collections;

using System.IO;

using System;

public class FileReadWrite : MonoBehaviour {

//不同平台下StreamingAssets的路径是不同的,这里需要注意一下。

public static readonly string PathURL =

#if UNITY_ANDROID //安卓

"jar:file://" + Application.dataPath + "!/assets/";

#elif UNITY_IPHONE //iPhone

Application.dataPath + "/Raw/";

#elif UNITY_STANDALONE_WIN || UNITY_EDITOR //windows平台和web平台

"file://" + Application.dataPath + "/StreamingAssets/";

#else

string.Empty;

#endif

//切记,你的二进制文件一定要放在StreamingAssets !!!!!!

#if UNITY_EDITOR

string filepath = Application.dataPath +"/StreamingAssets"+"/my.xml";

#elif UNITY_IPHONE

str

你可能感兴趣的:(unity获取android本地的文件,Unity中C# 文件本地读取,本地保存等实例)