Adam's Lair Forum

How to use Pixmap Atlas?
Page 1 of 1

Author:  Bradh4x [ 2018/12/28, 23:12 ]
Post subject:  How to use Pixmap Atlas?

Hey guys, new to forum, been using Duality for prolly little more than a month. Usually any issues I come across I end up figuring out or luckily someone on here had the similar problem; However can't seem to find this one, and I do apologize if this was asked before and answered.
Pretty much I have a pixmap that I created an atlas on to access the separate imgs within the object but I can't seem to. I connect it with a contentref<pixmap> in a gameobject that holds UI icons, fonts, etc.. I've tried using the Material obj as well still not accessible. I appreciate any help you can lend and I apologize if this is easy and I'm just being stupid about it lol

Author:  Adam [ 2018/12/29, 14:13 ]
Post subject:  Re: How to use Pixmap Atlas?

Hey there and welcome!

So you put multiple sprites on one image, and then want to use the Pixmap atlas to address them, correct? Here's a rough outline on how you can do that:

  1. Import the image as a Pixmap via dragdrop or import dialog. (You have done that already)
  2. Generate an atlas for the Pixmap, either by using its sprite sheet importer properties SpriteSheetColumns/Rows if it's a completely regular layout, or by right-clicking the Pixmap and choosing "Slice Pixmap" to bring up the atlas tool.
  3. Once you're done, you can verify the atlas to be correct using the preview in the inspector window top left, where you can select the previewed atlas index.
  4. Create a Texture from the Pixmap, if none exists yet. (You probably have done that already)
  5. Create a Material that uses the Texture, if none exists yet. (You probably have done that already)
  6. Create a SpriteRenderer object that uses the Material with your atlas'ed image. To display a specific atlas rect instead of the entire image, set the SpriteIndex property to the index you want to use.
  7. If, on the other hand, you want to use access the atlas rects from code, use methods from the Texture resource to retrieve the appropriate UV rect, as seen in this line.

Hope this helps ^^ Let us know if you need more info.

Author:  Bradh4x [ 2018/12/29, 18:23 ]
Post subject:  Re: How to use Pixmap Atlas?

Ah yes, this is what I needed. Thanks man, I appreciate it

Page 1 of 1 All times are UTC + 1 hour [ DST ]
Powered by phpBB® Forum Software © phpBB Group