I recently updated my project with a new high res art and I am experiencing a problem now. Resources.Load returns null in a build, but works in editor. I tried builds for Windows and Mac that were built using 3.4.2 and 3.5.2.
When I remove half of art files from Resources folder builds are working perfectly. Also I reimported all assets a couple of times and it didn’t help.
It would be great to get some direction or hear your thoughts about this problem. Any help will be appreciated.
For example I have a test script that executes perfectly in the editor, but doesn’t work in a build.
if (Resources.Load (“Images”) != null){
Debug.Log("Images.xml is loaded! "); // executes in the editor
}else{
Debug.LogError("Can’t find Images.xml! "); // executes in a build
}
Is there any reference pointing to your resource? All resources are deleted from the builds, unless they are somehow referenced. As far as I know, objects from any scene of the build, objects that are referenced by those are part of the build only. You may try to add a dummy game object with a script that simply exists to have the references to those files you are trying to load. Hope it helps.
Just had the same problem : Resources.LoadAll in Awake fails to load if there’s too much data(but works in the editor). In my case, 49 100k files and 49 1mb files : only the former was loaded. The latter did return an Object[ ], which was cast to the right type: no errors, nothing amiss except missing data…
Shifting Load from Awake to Start and yielding between the two calls solved the problem for me.