- Home /
how do you assign a texture atlas pict to a texture
I made a texture atlas and I have the texture atlas info.
How do I assign a picture in the atlas to a gameObject?
Thanks,
Answer by ScroodgeM · Aug 21, 2012 at 09:49 PM
assign atlas as a regular texture to gameObject's material
customize tiling and offset of atlas based on your texture atlas info. details depends on atlas info format.
I assigned the atlas and it shows up on the texture as the entire atlas. I don't see how the gameObject knows which picture to use. The texture atlas info just has info about the pictures and their names. I don't see anything to set. Is it done with the inspector or with a script.
when you creating an atlas from textures, you SHOULD store information about coordinates for each source texture in new created atlas. these coordinates should be used to apply tiling/offset in texture parameters to use just a part of atlas to show
Answer by AlucardJay · Aug 22, 2012 at 09:04 AM
You will need to write a script that will read the atlas info, then calculate UV co-ordinates for the image you are looking to use. This is how UIToolkit among others work.
I have written my own, but it is customized to read TexturePacker text files only. You'll need to implement a .json reader to read your atlas info file.
Check my answer here : http://answers.unity3d.com/questions/290643/atlas-tool-like-ngui.html