Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Best Practice for Sprite Combining

Discussion in '2D' started by WhiteCastle, Apr 10, 2018.

  1. WhiteCastle

    WhiteCastle

    Joined:
    Sep 6, 2013
    Posts:
    14
    Hello! I have been mulling over the best plan for handling a 2D themed playing card game in Unity in regards to how I might manage my sprites. For example, consider the face-up version of a standard poker card. For the sake of a question, ignore the "faces" and the nominals, ea: 1-10,A,K,Q,J). I see two options to render these cards.

    Option A: With a high-res graphic for each suit (heart, diamond, spade, and club) I could render high quality cards with very little texture memory by having a simple atlas with nothing but the four suits. For a 10 of hearts card, I could arrange 10 instances of the heart using 10 game objects each with a SpriteRenderer each set to the same "heart" sprite. This low memory method has the disadvantage of requiring a complex nested game object with multiple SpriteRender(s) to display a relatively simple image. I plan to have multiple themed decks, so swapping themes seems a little heavy (I'd have to instantiate 52 different game objects instead of just swapping 52 sprites).

    Option B: Alternatively, I could create a single image (aka sprite) for the whole card face. In this case, 10 hearts already arranged in a nice pattern.

    Option A clearly uses less memory (and storage), than Option B However, there may be a matter of performance with Option A - rendering 14 sprites for one card and (more importantly) needing to instantiate a nested game object for each card. It is easy enough for me to compare these two options by just doing the work and comparing the difference. The reason I am presenting this to the community is to ask is there an option C or D that I am missing? Does anyone of other suggestions or thoughts about options A&B?
     
  2. furroy

    furroy

    Joined:
    Feb 24, 2017
    Posts:
    93
    I think you're overthinking it. Modern games have 100000s of tris and 1000s of textures. I wouldn't worry about the difference between 20 textures vs 50 textures. Use whatever form your art assets are already in or whatever gets you to market the quickest.
     
  3. WhiteCastle

    WhiteCastle

    Joined:
    Sep 6, 2013
    Posts:
    14
    Cool. Thanks for the reply.