- Home /
Resources.LoadAssetAtPath not working in WebBuild
I'm using the following loop to grab files for an animation. This method makes it really easy for our artists to export animations from flash as PNG sequences. It works perfectly fine when run from within the unity editor. The files load and the animations play at the right time; however, when we build the project for the Web Player (this game will only be playable through a browser) the animations don't happen and I'm sure it's because of the LoadAssetAtPath function.
Any Ideas?
while (true)
{
string tempPath = PATH + mName + intToPaddedString(currentFrame, 4) + ".png";
tempTexture = null;
tempTexture = Resources.LoadAssetAtPath(tempPath, typeof(Texture2D));
if (tempTexture == null)
return;
mTextures.Add(tempTexture as Texture2D);
currentFrame++;
}
did you try to print the tempPath var to the console? $$anonymous$$aybe it's not working on the webplayer because you're passing a full path (when it should be a relative path)?
Answer by GuntherFox · Feb 09, 2012 at 09:09 PM
Figured it out. I need to use
Resources.Load
instead of LoadAssetAtPath. It says right in the documentation that LoadAssetAtPath will return NULL in the web player -_-
Your answer
Follow this Question
Related Questions
what happened to First Streamed Level With Resources? 0 Answers
LoadAssetAtPath 1 Answer
Lag on first animation played 0 Answers
How to change the image (texture) of a GUITexture in C#. 3 Answers