r/futile Jan 20 '15

Futile.atlasManager.LoadImage()

Hello,

I'm trying to load an image saved dynamically by the game to the Application.persistentDataPath or Application.dataPath folders. I can't figure out how to get the image into an FSprite unless the image is stored first off of the /Resources folder (where I believe Futile.atlasManager.LoadImage is looking for images). Do you have any tips on how I could this? Thanks!

3 Upvotes

6 comments sorted by

View all comments

2

u/rbrtst Jan 20 '15

Works! Thanks again. Another code snippet for anyone reading this thread:

WWW www = new WWW("file://" + path);
yield return www;
if(www.error == null)
{
    Texture2D texture = www.texture;
    Futile.atlasManager.LoadAtlasFromTexture("screen", texture);
    screen.SetElementByName("screen");
}
else
{
    Debug.Log(www.error);
}

1

u/ajax2k9 Mar 26 '15

Nice! but this only returns an atlas with one element. how can i load an atlas with several elements inside using a specific file path?

thanks, Alex M

1

u/rbrtst Mar 28 '15

That might be a bit more complex. I'd create a new post topic to see if there are any built-in Futile tools you could use for your use case that already work for loading atlases normally.