Can we affect the packing order when using Texture2D.PackTextures

Hello fellow Unity3d Users,

First off, thanks for taking the time to look at this post.

[The issue]
I’m using Texture2D.PackTextures(textures[],0)
All of the textures I’m packing are the same Width(256) and Height(256).
I’ve added each texture to an array in the order In which they need to be, however the order always breaks, resulting in 1 or 2 frames of the animation being offset vertically and/or horizontally.


[edit - Little Angel]

     //The Atlas were we're storing our textures
    Texture2D atlas = null;
    //The Locations of our textures on the atlas
    Rect[] rects;
    //The textures we're going to back
    List<Texture2D> temptextures = new List<Texture2D>();
    //The width and hight our our textures
    int[] texturesize = new int[2];

    //Add textures for each Animations
    //to the atlas
    foreach (PsiAnimation psianim in LoadChosenAnimations())

    //Add The required width and high
    //to the atlas
    //for each texture
    Texture2D[] texturearry = new Texture2D[temptextures.Count];
    foreach (Texture2D t in temptextures)
        texturearry = ArrayHelper.AddItemToArray<Texture2D>(texturearry, t);
        texturesize[0] += t.width;
        texturesize[1] += t.height;

    //Make the atlast the size needed
    atlas = new Texture2D(texturesize[0], texturesize[1]);

Debug.Log(atlas.width + atlas.height);
Debug.Log(texturesize[0].ToString() +" : w| h " + texturesize[1].ToString());

    //Store the coords of each texture
    rects = atlas.PackTextures( texturearry,padding);

AFAIK no, you can not.

But the rects returned by PackTextures is what you can use - it’s relative position (UV coordinates) of each texture in the atlas so you can use these to run your animation - rects[0] contains position of first frame, rects[1] second frame etc.