SpriteAtlas problems

This is my first time using SpriteAtlas. I packed 8 256x256 textures into a SpriteAtlas and then tried to access the sprite using:

material.SetTexture(“_MainTex”, atlas.GetSprite(names).texture);

The GetSprite is returning a 1kx1k texture which is the entire packed image.

Any ideas

Hi, MertailAtHome.
It seems that you are misunderstanding about “Atlas”.
Atlas image such as SpriteAtlas is one big image which packs some small images.
Each packed sprite is presented as uv-offset, trimmed atlas image.
For Instance, Atlas:512x512, each image :256x256
First image is presented as offset(0.0, 0.0), size( 0.5, 0.5) of atlas texture.
Second ( or third ) image is presented as offset(0.5, 0.0), size(0.5, 0.5) of atlas texture.
The last one is also presented as offset(0.5, 0.5), size(0.5, 0.5) of atlas texture.

Furthermore, sprite is not texture.
Sprite has Mesh info and texture info.

Though you want use sprite for shader, texture is Big Image “Atlas”.
so the shader refers atlas image.

If you want to use image packed in atlas image, you need to tell shader about uv offset and size.
But Unity do not provide the information about uv-offset and size by API.
Or, you have to convert Sprite to Texture( or Texture2D ) by somehow method.(I dont know how to do it)