Odd title. Maybe I can explain better.
I’ve made a Build script so that I can package my assets for WWW transport. I use Resources.LoadAssetAtPath(path, type); to temporarily fill an object array, which I then pass off to BuildPipeline.BuildAssetBundle, which gets LZMA to package… etc etc.
Anyway… I know Resources.LoadAssetAtPath only works in the Editor, and as far as I know, the BuildScripts are part of the editor, so this should work. But, I’m only getting Null returns.
List<string> fileList = getTextureFiles(folder);
List<UnityEngine.Object> objectList = new List<UnityEngine.Object>();
string assetRelFolder = "data" + folder;
foreach (string file in fileList)
{
UnityEngine.Object myText = Resources.LoadAssetAtPath(assetRelFolder + file, typeof(Texture));
Debug.Log(myText);
objectList.Add(myText);
}
BuildPipeline.BuildAssetBundle(null, objectList.ToArray(), bundleTempDir + bundleName);
Funny thing is, I can File.Exists on the same path used on the LoadAssetAtPath, and it returns true, but I’m getting a null return on LoadAssetAtPath.
Is Resources.LoadAssetAtPath restricted to only “Assets/…” directories? Is it a RELATIVE pathname that I should be using? Or can I use a direct path?
I have an external image directory:
C:\Project\Data\Images
The unity project is:
C:\Project
And there is an assets folder:
C:\Project\Assets
I’m attempting to use Resources.LoadAssetAtPath to pull from the “data/images” directory.
I’m really sorry I’m not good at explaining things.