Search Unity

Are there any ways to place about 100 animals in a image ?

Discussion in '2D' started by tle94, Aug 25, 2016.

  1. tle94

    tle94

    Joined:
    Dec 8, 2015
    Posts:
    13
    Hello,

    I'm going to develop a small game with Unity2d. In my game, it will show up 1 animal every "specific time", and I want to have about 100 different animals in my game. As my understanding, I need to import 100 animal images to my game project. So can we put all 100 different animal images in a same image then split one by one in Unity ? Or Unity has provided other ways that we can apply for this case ?

    Hope receive your advises ...

    Thank you very much,
     
  2. takatok

    takatok

    Joined:
    Aug 18, 2016
    Posts:
    1,496
    It does, especially if every animal image is the same size. If you load all the images onto one file and load that file into unity. One of the options in the editor is to set the spirte from Single to Multiple image. Then you can load that sprite into the sprite editor and use a slicing tool to extract them all. This link explains it in more detail with pictures:

    https://docs.unity3d.com/Manual/SpriteEditor.html
     
  3. tle94

    tle94

    Joined:
    Dec 8, 2015
    Posts:
    13
    Many thanks takatok,

    Could you please advise which way is better ? import all 100 images or use single image with 100 images inside ?
     
  4. takatok

    takatok

    Joined:
    Aug 18, 2016
    Posts:
    1,496
    I don't have much knowledge of how Unity handles slicing up an image at the low level internally. However, better can be determined from 2 factors:
    1. Performance. If each individual file adds a little extra overhead (either data or processing time) vs indexing them out of one big file. Then obviously the big file solution is better. I suspect even on slower processors of phones this difference is not going to be noticeable on 1 big file vs 100 little files.
    2. Which bring us to Developer ease of use. If you(your artist) find it easier to create the images and export them as one large file go that route. If the artist doesn't care, then whichever way the programmer finds easiest to load and manipulate in the Unity Editor should be the way to go. If no one really cares use the 1 big file, its bound to be more readable in the Project Tab.
    TLDR: With such a small amount of data, I'd use whatever way is more convenient/easiest to understand.
     
    tle94 likes this.
  5. tle94

    tle94

    Joined:
    Dec 8, 2015
    Posts:
    13
    Thank you, Takatok