Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

How to get tile size and grid cell size the same?

Discussion in '2D' started by roseportalgames, Aug 25, 2021.

  1. roseportalgames

    roseportalgames

    Joined:
    Aug 9, 2017
    Posts:
    173
    Hi everyone,

    I am having trouble getting my Tilemap & palette to work properly. I have the Grid size to 1,1 and my Tile palette size also to 1,1. But as you can see in the screenshot, my actual graphic falls outside of the tile I'm drawing. I've played around with different values but it's not working out.

    The actual pixel count of each tile is 128x128.

    upload_2021-8-25_9-4-53.png

    upload_2021-8-25_9-5-49.png

    Also I have to set the scale of my Grid to 40,40 otherwise it's really really tiny. Is that normal?
     
  2. roseportalgames

    roseportalgames

    Joined:
    Aug 9, 2017
    Posts:
    173
    Update: I set pixels per unit to 128 of the tile set texture and now it works better. Is that the correct way to work with them? Or am I now just doing a wrong hacky thing?
     
  3. roseportalgames

    roseportalgames

    Joined:
    Aug 9, 2017
    Posts:
    173
    Also, side question, how can I get rid of those empty pixel lines between my tiles when scrolling with the camera?

    I already turned off anti alias on the tiles and set the mode to Repeat but I still get it sometimes when scrolling...
     
  4. ChuanXin

    ChuanXin

    Unity Technologies

    Joined:
    Apr 7, 2015
    Posts:
    1,068
    Hi, this is the correct way to handle this!

    You can try adding your Sprites to a Sprite Atlas and packing them. This will only take effect in PlayMode.
     
    roseportalgames likes this.
  5. roseportalgames

    roseportalgames

    Joined:
    Aug 9, 2017
    Posts:
    173
    Thank you!! That fixed it!!