Files put inside a Resources folder still don't end up in the build

Heya,

I’m saving (small) puzzle levels by creating data containers and serializing them. They can then be loaded at runtime to build each level.

Now I created an Resources folder inside the Editor, imported several levels, and then built the game. However, none of the files are ever found in the Resources folder of the final build, needing me to import them myself. This usually wouldn’t be an issue, but since I am using Unity Cloud Build, I can’t simply insert the files onto the server, since I can’t tamper with the builds.

Every resource I checked, including the doc, says that all files inside one (or multiple) resource folder/s will be included in the build, even if not referenced by any objects.

Note, I am not using Resources.Load(); since I couldn’t yet figure out I would properly type the file that I get returned. (I save them by feeding a FileStream into a BinaryFormatter, which is also the way I load them. If anybody got any advice for how to use Resources.Load and then deserialize the object, I’d be glad.)

Now I created an Resources folder inside the Editor

This is the problem. In any circumstances any files put in ‘Editor’ will be excluded in the build, including that ‘Resources’ Folder. You really need to move that folder outside from the Editor folder.

And About Resources.Load… I’m usually use it’s generic version, like

Resources.Load<Texture>("Folder/Texture") // Relative path excluding the extension 

Texture is used if it a texture, or TextAsset if it contains a plain text.

EDIT : This is how i use the JsonUtility:

[CreateAssetMenu]
public class TileDataContainer : ScriptableObject
{
    public int level;
    public List<ThumbDetail> tiles = new List<ThumbDetail> ();

    public static TileDataContainer Load (int level)
    {
        var l = "TileData" + level.ToString("0");
        if (PlayerPrefs.HasKey (l)) {
            var r = ScriptableObject.CreateInstance<TileDataContainer> ();
            JsonUtility.FromJsonOverwrite (PlayerPrefs.GetString (l), r);
            return r;
        } else {
            // You need to create this scriptable inside the "Level" folder in 
            // resource folder named "TileData0", "TileData1"...
            // use 'Create' menu in the project tab for that.
            var r = Resources.Load<TileDataContainer> ("Level/" + l);
            return r;
        }
        // Now always save the return value somewhere in your code, not from here anymore.
    }

    public static void Save (TileDataContainer data)
    {
        var l = "TileData" + data.level.ToString("0");
        var s = JsonUtility.ToJson (data);
        PlayerPrefs.SetString (l, s);
        PlayerPrefs.Save();
    }
}