Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
5
Question by fisyher84 · Jan 10, 2012 at 08:49 AM · androidfolderfile-io

How to access persistent data path in Android phone?

I am working on porting my Unity windows application to Android and have been trying to figure out how to re-implement the external config-file reading process on a Samsung Galaxy Tab.

I have read that Unity has the Application.persistentDataPath function that returns a safe path for the Android application to perform file IO. On the Galaxy Tab, it returns "data/data/com.MyDemo/files". I have been trying to copy a simple text config file from windows to that persistent data path on the Android device directly via USB but no matter what I do, I simply could not find the directory anywhere, either in both windows explorer or on the device file manager itself.

This is really baffling to me. How on earth can I "install" basic config files if I cannot even access the data folder manually? Is there anyway to do this?

Comment
Add comment · Show 4
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image fisyher84 · Jan 12, 2012 at 06:55 AM 0
Share

Does anyone even visit this website? It seems to pale in comparison with StackOverflow...

avatar image CHPedersen · Jan 12, 2012 at 07:40 AM 0
Share

It does. It's a combination of two things: A: StackOverflow is more general, so it attracts a far larger audience, and B: Unity takes almost no technical knowledge to get started with, but pretty much a full-fledged university-level programmer to master. So, as a result, the Q&A website gets a really tilted ratio of beginners to experts. Sorry I can't be of actual assistance with your question, I guess I just... needed to vent that. >_<

avatar image fisyher84 · Jan 16, 2012 at 05:30 AM 0
Share

Any answers?

avatar image Invent4 · Jul 29, 2014 at 05:02 PM 0
Share

Find a good software to open/show the Android folders in your Windows. I'm trying some software for this, and find the Android Commander as a good option. Link: http://android-commander.en.uptodown.com/

3 Replies

· Add your reply
  • Sort: 
avatar image
9
Best Answer

Answer by colchambers · Oct 30, 2012 at 08:43 PM

You need to change the build settings for android. change configuration > write access to external (sd card).

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
14

Answer by Calvin2274 · Sep 11, 2014 at 08:12 AM

Application.persistentDataPath have two paths base on your Write Access setting, you can find it at Build Setting > Player Setting > Other Settings, by default, it is internal Only. means that the path should be point to /data/data/com.your.appid/files which is for development only, user cannot find this files without root android device.

if you set the Write Access as External(SD Card) or add WRITE_ EXTERNAL_STORAGE permission into AndroidManifest.xml, Application.persistentDataPath will point to Android/file/com.your.appid/files of your sd card.

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image isteffy · Jul 26, 2016 at 12:11 PM 0
Share

This answer also is correct but goes into a little more detail than the selected answer. Thanks Calvin.

avatar image Fenikkel · Aug 16, 2021 at 09:49 AM 0
Share

@Calvin2274 And if the phone don't have an SD Card slot or we don't have any SD Card?

I changed the the Write Access to External(SD Card) but still can't see the file.

Edit: If you don't have an SD Card, the file doen't appear in Android/file/com.your.appid/files because it's the Internal Memory of the phone. If you print the Application.persistentDataPath while you don't have an SD Card, it still prints the path Android/file/com.your.appid/files. As far as I tested, you can create a file in the persistent data path, but you can't access it via the File Explorer. Also you can read this invisible file and write on it, but you need to do it via script. I made an app for my self to read and show the information of my JSON database. Also to make changes.

avatar image
0

Answer by shishirams222 · Apr 05, 2019 at 01:33 PM

Is there any option to make the files accessible within internal storage rather than external sd card?? @Calvin2274

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Calvin2274 · Apr 10, 2019 at 01:42 PM 0
Share

Hope this could help you.

https://stackoverflow.com/questions/42630590/how-to-access-file-in-android-internal-storage-for-unity-app

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

15 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Add a pdf file 0 Answers

Android File-io? 1 Answer

Check if folder exists - Unity's way 2 Answers

Loading from multiple files? 2 Answers

Reading files on Android, 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges