How to store data in Resources folder of my app

Hi,

In my project I’m building an app for android based on unity.
One part of my project, I have to save a file in ‘Resource’ folder and after that I have to access the file from resource folder.
I am able to access that file from ‘Resource’ folder using

Object modelObjectPrefab = Resources.Load(“Models/modelFile”, typeof(GameObject));.
where ‘Models’ is a sub-folder in ‘Resource’ directory and ‘modelFile’ is the file name.

But, I’m unable to store files in ‘Resource’ directory. I have tried by using StreamWriter, but it suggest that file path is not exists.
I used following method to get ‘Resources’ directory.
string resourcePath = Application.persistentDataPath + “/Resources/Models”;.

And app suggest that ‘resourcePath’ does not exists.

Please help me to resolve the issue:

  1. How to store data in Resource directory while executing app in android device.

Thanks

I was trying but don't understand how the templates work Edit: I got the code to work in the actual code but not the template public bool gkd(KeyCode keycode) { return Input.GetKeyDown(keycode); } void Update() { if(gkd(KeyCode.W)) { dbug("W Pressed"); } }

1 Answer

1

There is no Resources folder you can write to in a build (see this question). You have to use a different folder on your device for saving files. You could create a Resources folder in Application.persistantDataPath and save your files there at runtime, but you won’t be able to load them via Resources.Load

than how can we load that data??