- Home /
PackTexture not packing correctly?
I have a script with this
public Texture2D[] World_Textures;
public Texture2D WorldTextureAtlas;
private Rect[] m_WorldTextureAtlasUvs;
Later, I do this for the atlas generatio:
WorldTextureAtlas = new Texture2D(2048, 2048);
m_WorldTextureAtlasUvs = WorldTextureAtlas.PackTextures(World_Textures, 0);
Debug.Log(WorldTextureAtlasUvs[0]);
Now, I currently only have two textures in Texture2D[] World_Textures , both are 256x256.
However, the atlas I get back stretches them to an atlas of 512x512...effectively doubling the height of my textures and their uvs. The debug statement shows this:
(left:0.00, top:0.00, width:0.50, height:1.00) UnityEngine.Debug:Log(Object) World:InitializeTextures() (at Assets/Scripts/World.cs:58) World:Start() (at Assets/Scripts/World.cs:41)
Any idea why this is?
Answer by jc_lvngstn · Oct 27, 2010 at 08:26 PM
Nevermind, I realize that I wasn't thinking about what the UV coordinates were really about. It was only making the atlas 512x256...the first texture was from 0 to 0.5, and 0 to 1 in the ATLAS.
Your answer
Follow this Question
Related Questions
Is it possible to get the atlas for a font texture? 1 Answer
Packing unity textures into atlases 0 Answers
Unity 5.2 Sprite packer too slow 1 Answer