分类:
1. Assets根目录:
2. Resources目录:可以在根目录下,也可以在子目录里,可以使用Resource.Load()方法加载资源。
3. StreamingAssets目录:只读,不会被Unity压缩
4. PersistentDataPath:可读可写,只能在运行时创建,是iOS或者Android的应用程序沙盒。
- Win || OS X:
//Assets根目录
Application.dataPath + "/Assets"
//StreamingAssets目录:
Application.dataPath + "/StreamingAssets"
Application.streamingAssetsPath
- iOS:
//StreamingAssets目录:
System.Environment.CurrentDirectory + @"\Assets\StreamingAssets\";
Application.streamingAssetsPath
//PersistentDataPath目录:
Application.persistentDataPath + "/config.xml";
- Android:
// Assets根目录
"jar:file://" + Application.dataPath + "!/assets/";
//StreamingAssets
Application.streamingAssetsPath