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

2D tile based world-best practice

Discussion in 'World Building' started by liorb, Jun 25, 2020.

  1. liorb

    liorb

    Joined:
    Oct 16, 2016
    Posts:
    4
    So,
    I want to create a 2d tile-based world.
    In this world, I, generally speaking, have ground/dirt, water areas, lakes, mountains, etc....
    The world is created randomly. Nothing is pre-designed.
    What are the best practices for placing ground and water tiles?
    1. do I :
    2. place water tiles above ground tiles (layering)?
    3. or
    4. create the ground tiles, deleting some of them for the water tiles?
    Is there a better way?

    I appreciate your advice.
    Thank you.
    LB.
     
  2. liorb

    liorb

    Joined:
    Oct 16, 2016
    Posts:
    4
    Anyone?
    Need the advice
    PLZ
     
  3. JoshWindsor

    JoshWindsor

    Joined:
    Jun 2, 2018
    Posts:
    24
    Hi there,

    While far from a pro, I have found that creating a single Grid using the Right Click in heirarchy -> 2D Object -> Tilemap, then duplicating the child of that grid for the additional layers has been the cleanest way.

    In this snip I have renamed the grid to Tilemaps, and then the tilemaps are stored below with a background for floor and scenery, midground for additional tiles, you could create an additional forground tilemap for scenery above the player and set that up via sorting layers.

    upload_2020-6-30_12-42-8.png

    I've been keeping all tilemaps as a child of the initial Grid and have an empty game object to store prefabs of world object prefabs like trees and other interactables.

    I've also been using an additional tilemap called colliders, which has the tilemap renderer switched off so the tiles cannot be seen and it also has a collider to provide boundaries on on the world.

    I don't know if this is the best advice but hopefully it helps.

    All the best,
    Josh