What is the proper method to store an arbitrary file in the Asset folder that is always availble?

Is it Application.dataPath? I’m somewhat confused about what it says about a few platforms:

  • Web player: The absolute url to the player data file folder (without the actual data file name)
  • WebGL: The absolute url to the player data file folder (without the actual data file name)

What is the “player data file folder?” That doesn’t sound like a place where permanent readonly assets will be stored, so how do I ensure I can always access a path in the asset folder for read and write in Editor and for read-only in final build?

Throw it in the resources folder.

That’s not possible, since there is no local file access in webplayer or WebGL apps. You can download files from the web only.

–Eric

Here’s my specific problem - I want to have a standard System.Object class that automatically acquires a link to a specific ScriptableObject instance that will always exist as a singleton in my project folder. Is there no way to do this?

What BoredMormon said about Resources sounds like what you’d want, then, since any assets in Resources are always included in a build regardless of whether they are directly referenced or not. You wouldn’t be able to load Unity objects as arbitrary external files anyway.

–Eric

I guess I was confused on the nature of “Resources” folder - It said something about them not downloading with the rest of the assets on webplayer.

I don’t think so. Unity - Manual: Loading Resources at Runtime

–Eric

This is what is confusing me on that page: “Furthermore, you may even want to load assets from a separate file or URL to reduce initial download time or allow for interchangeable game content”

The key word is interchangeable content. Is your asset going to be present in the build and always the same? Use resources. If you asset will not be present until runtime you will need something more sophisticated.

It’s not talking about Resources, it’s talking about asset bundles.

–Eric