Sprites and draw order

Hello - first time post here so greetings to all.

I am trying to learn how to use PlayCanvas to make a 2D game and am trying to understand how sprites work. I’ve two quick questions:

  1. I created two sprites and positioned them in the same place. When I put them on the UI layer, and then set the draw order for them (first one 1 and the second one 2) they get drawn in the order I expect. However, if I put both sprites on the World Layer and do the same, only one of them gets drawn, even when I give them different draw orders. The only way to get them to draw in the correct order is to position one of them closer to the camera. Is this normal behaviour? Should I only be putting sprites on the UI layer?

  2. In order to create a sprite, it seems I have to upload an image, then convert it into an atlas, then convert the atlas into a sprite. So for two sprites, I now have two atlases. Is it normal to have a separate atlas for each image I upload? My preconception of atlases was that they were used to combine multiple images into one big image.

Many thanks!

  1. Draw order is only used if the render order on the layer is set to manual.

I would recommend creating your own layer for (eg 2D World) and changing the sort order to be manual.

  1. Not normal but is doable. As you mentioned, it is preferred to have all the sprites on one or a couple of images. Texture Packer is supported here that helps make it a lot easier: Is it possible to use Texture Packer? Or you can create multiple sprites within the Sprite Editor itself on PlayCanvas by creating frames and then making sprite assets from those frames: https://developer.playcanvas.com/en/user-manual/2D/sprite-editor/#editing-texture-atlases
1 Like

Thanks yaustar, that makes sense now. I appreciated your help.