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

Question Unity Tilemap but Custom tile Size

Discussion in '2D' started by Amine22dev, Aug 17, 2023.

  1. Amine22dev

    Amine22dev

    Joined:
    Aug 17, 2023
    Posts:
    3
    How can I adjust the size of a tile or Rule tile in the tilemap, so that it covers more or less cells? I want to do this either by coding or by using the inspector.in same layer of tilemap you can have tiles that cover 4*4 cells or 3*3 ..etc how can i achieve that. Please answer as soon as you can .
     
  2. venediklee

    venediklee

    Joined:
    Jul 24, 2017
    Posts:
    143
    Easiest way of this would be just using larger sprites(more width and height) or reducing the pixels per unit of the sprites
     
  3. Amine22dev

    Amine22dev

    Joined:
    Aug 17, 2023
    Posts:
    3
    But when I do that only sprites will get bigger but in tilemap you are only occupying one tile i need a way to tell the tilemap that those cells are actually occupied and belong to that prefab for example I have a monster that i want to place in my tilemap and if i want to delete it during runtime I can delete any of the cells that belong to that monster and then the whole monster will be removed but in unity you will have to delete a certain cell so the monster get deleted(this concept implemented in mario maker you have bowser that take 2*2 cells of the tilemap and if you delete one of the 4 cells that he covering you can delete bowser and place blocks in that place if you want) please help me if you have any Ideas on how to solve that
     
  4. venediklee

    venediklee

    Joined:
    Jul 24, 2017
    Posts:
    143
    It is a bit hard to understand this paragraph without any periods.

    You can use 2 tilemaps, one for the ground for the monsters, so deleting one of them won't change the other etc.

    That being said, I wouldn't place monster sprites to tilemap. I would just use gameobjects with sprite renderers. You can still align the gameobject with the tilemap using https://docs.unity3d.com/ScriptReference/GridLayout.CellToWorld.html
    This will allow for more customization like highlighting the monster sprite when hovering over it etc. later on
     
    Last edited: Aug 18, 2023
    Amine22dev likes this.
  5. Amine22dev

    Amine22dev

    Joined:
    Aug 17, 2023
    Posts:
    3
    that's exactly what i was looking for thanks mate
     
    venediklee likes this.