Search Unity

Creating Tile Prefabs

Discussion in '2D' started by TallLalasoda, May 21, 2019.

  1. TallLalasoda

    TallLalasoda

    Joined:
    Mar 5, 2019
    Posts:
    5
    As the title states, how do I create Tile prefabs that works with Unity's Tilemap?
    I want to create a prefab that spans 3 tiles, and whenever X occurs, add these 3 tile pieces into a TileMap at location Y?
    But I'm stuck on how to instantiate these 3 tiles.
     
  2. CruS

    CruS

    Joined:
    May 29, 2013
    Posts:
    9
    I have the same question.

    What I did to "solve" this: Create a TileMap with the three tiles, and make a prefab of the TileMap (just drag it into the assets folder) and then instatiate the whole TileMap multiple times onto the grid. Clearly, this is not great but it does work.

    One of many issues with this approach is that the prefab editor is broken for TileMaps (doesn't work at all?)
     
  3. TallLalasoda

    TallLalasoda

    Joined:
    Mar 5, 2019
    Posts:
    5
    Ooh not sure if that’s the best way, I’d like to rotate the placement of it as well >.<. Let’s hope someone enlighten both of us
     
  4. theGreatSlutze

    theGreatSlutze

    Joined:
    Jan 7, 2013
    Posts:
    25
    I'm in the same boat. I'd like to create a bridge prefab that spawns when the player presses a switch but all my solutions so far have involved a lot of scripting and it'd be great to find a way to handle it with editor tools.
     
  5. Cressidali

    Cressidali

    Joined:
    Feb 19, 2018
    Posts:
    13
    As far as I know, there is no way of doing this with editor tools, it needs some scripting. If you still need help please add more information on how you need it to behave.