Is it possible to omit specific files from a Resources folder from the iOS build?
Why you may ask?
Because I have code for emulating ads such as Chartboost/Flurry in the Editor (to help with getting the flow correct before running on the device). I load textures from Resources as required and use GUI.DrawTexture to show them. I don’t want these textures going into my iOS build as they’re not needed.
Ok, I found a solution of sorts (for my particular situation).
Instead of putting the textures in a Resources folder, have them elsewhere and use WWW with the file:// protocol to load them. As long as they are not referenced directly then won’t be part of the build.
#if UNITY_EDITOR
string url = string.Format("file://{0}/Common/CB/MoreApps.png",Application.dataPath);
WWW www = new WWW(url);
yield return www;
// Now use www.texture as required
#endif
So, how exactly do we “reference the resources directly” ?
My builds are for windows, but - it omits resources by random, on each build,
or they do appear, but - not working properly …
Is there anything on Unity Asset Store, that fixes this problem ?
Or any experts who indeed tested this, and know what to do for shure ?
Michael.
You can also use Resources.LoadAssetAtPath, and load asset from any folder of you project inside Asset folder. This function works only in Editor and will return null in Player