Application.persistentDataPath

今天研究一下Application.persistentDataPath,做个案例,如下,使用persistentDataPath可以在真实手机上临时保存一些数据,经过测试在真实手机上是不能够使用Application.streamingAssetsPath和Application.dataPath的,如果想临时保存一些数据,只能够用Application.persistentDataPath


Application.persistentDataPath_第1张图片


上面实现的功能是:
在输入框内输入内容
点击保存按钮后,将输入框内容保存在Application.persistentDataPath路径下的文件
然后再点击显示,将输入框保存的内容再显示出来


实现代码如下:


Application.persistentDataPath_第2张图片


发布到手机上截图如下:


以下是手机截图:


Application.persistentDataPath_第3张图片


Application.persistentDataPath_第4张图片


Application.persistentDataPath_第5张图片


FR:徐海涛(Hunk Xu)

你可能感兴趣的:(Unity保存)