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

Can not edit procedural generated Tilemap with default brush

Discussion in '2D' started by DocLovepeace, Nov 16, 2017.

  1. DocLovepeace

    DocLovepeace

    Joined:
    Dec 13, 2016
    Posts:
    9
    Hi,
    I am currently experimenting with a function to generate procedural tilemaps.
    My problem is, that I can not edit the tiles I generated using the
    tilemap.settile(position,tile) function afterwards.
    I am trying to delete or paint over the tails using the default brush.
    Looks like it should be something quite simple, right?
     
    Last edited: Nov 17, 2017
  2. DocLovepeace

    DocLovepeace

    Joined:
    Dec 13, 2016
    Posts:
    9
    Problem is solved.
    I am not quite sure, but it seems to make a difference how i loop through the tilemap positions when placing
    tiles on the map.
    Using tilemap.cellbounds.allPositionsWithin has generated an editable tilemap for me.

    Second options would be a bug in a previous version before b09.
     
    Last edited: Nov 17, 2017
  3. DaviDeMo

    DaviDeMo

    Joined:
    Nov 13, 2017
    Posts:
    15
    Hi, I have the same problem and I don't know how to fix it. I have a simple test code:

    for (int i = down; i <= up; i++)
    {
    tilemap.SetTile(new Vector3Int(left, i, 1), tile1);
    tilemap.SetTile(new Vector3Int(right, i, 1), tile1);
    }


    but I can not edit it with the brush on the editor. How did you fixed it?

    Thank you
     
  4. DaviDeMo

    DaviDeMo

    Joined:
    Nov 13, 2017
    Posts:
    15
    Ok, the problem was the z position of SetTile.

    Z of Vector3Int should be set to 0 instead of everything else to be able to edit it with brush in the editor mode.