- Home /
Resources.Load not working in flash build. I Can't find answer anywhere.
Hi all,
I assume this is an obvious issue but I cant find the answer. I have some text files in my resources folder that I'm loading fine with Resources.Load("filename") as TextAsset both in in the editor and on iOS. I am trying to build the game to flash as well and Resources.Load is not working at all. The game builds and runs but when it gets to Resources.Load it just quits the call stack and continues on.
How would I load my text files (there are a lot of them and they will be loaded as needed in the game) in a way that is compatible both with iOS and Flash (the two platforms this game is destined for) and is efficient when loading many small files ?
PS) What i mean by it just quits the call stack is this :
void Method () {
Debug.Log("Before");
OtherMethod();
Debug.Log("After");
}
void OtherMethod () {
TextAsset asset = Resources.Load("filename") as TestAsset;
Debug.Log(asset.text);
}
When in the editor or on iOS this works fine and the output is:
Before
blah blah blah
After
However in Flash it only outputs:
Before
But the game keeps on functioning normally.
125*EDIT:*125
I do have a 'Resources' folder in my project and unless the flash build process omits it, it should be included. I didn't think that using the Resources folder would cause security issues as all the files in 'Resources' are included into the project at build time, and Resources.Load just references them.
Unity lets it build and run with Resources.Load call in there, I thought that most things that are not supported by Flash would cause build errors or at least warnings, the fact that that didn't happen made me think it should work (albeit with a bit of tweaking maybe).
I installed the Debug flash player and the logs show that Resources.Load is returning null, so it cannot find the path specified. The path and Resources.Load works fine every other build target so it is something in the Flash support.