Get resource path

Hi,

I use Resources.LoadAll(path) to load all items in the folder and subfolders.
After I do this I would like to get the subfolder’s name of the objects, or the complete path like I see in the editor. Is this possible?

And don’t suggest AssetDatabase, because it is an editor class, and I need it in my build.

Thanks in advance.

To come to the conclussion that it is not possible to get the path data inside the Resources.

I have com up with this idea:
I named my files in the resources map ‘folder-name’

ex: RootFolder/Test/Test-Object

So in this case I can split my name name.Split(‘-’) and get an array of [0] = subfolder [1] = name and this to the resources

Or like RoflHarris said, you can also let a file be generated with the folder structures.

Also if others are looking for something temporary, I was able to put my files into the StreamingAssets folder and get their path…

var filePath = System.IO.Path.Combine(Application.streamingAssetsPath, "MyFile");

Note that this doesn’t work for all platforms, but I was able to use it on iOS for temporary storage of test files. You may be able to rework this for production.

http://docs.unity3d.com/Documentation/ScriptReference/Application-streamingAssetsPath.html

Alternatively, for GameObjects you can create a component that identify when a object is in resources and its path. Next you create a Editor script to update all paths.