Search Unity

Tile Map SetTileFlags, SetColor bug ? [ CLOSED]

Discussion in '2D Experimental Preview' started by castor76, Feb 16, 2017.

  1. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    1,399
    I can't seem to be able to set flag or color of a tile by using API.

    For example :

    if I use

    tilemap.SetTileFlags(pos, TileFlags.LockColor);
    Debug.Log(tilemap.GetTileFlags(pos));

    I get the result "None". The same goes to the setting color by using .SetColor. It just returns white.

    Am I missing something here? Do I need to update or refresh that particular tile in some way?

    SetTile does seem to work correctly.
     
  2. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    1,399
    any one?
     
  3. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    1,399
    Perhaps everyone has gone to GDC?
     
    Jay-Pavlina likes this.
  4. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    1,399
    It would have been nice, if there was any notice on the forum indicating that there will be slow respond during what ever event the Unity crews are attending. have not heard anything back from them for quite some time.
     
  5. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    1,399
    I wonder if anyone from Unity coming back to this forum sometime...or when there will be back.
     
  6. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    1,399
    After a lots of experiments, I found that setting tile can override the flags and colors that were previously set and it was probably caused by using the tilebase instead of tile which doesn't have information such as flag and color. This took too long to figure out... I wish there is some warning or error for this indicating the reason for it. Oh well.
     
    kimjooho likes this.
  7. esteban16108

    esteban16108

    Joined:
    Jan 23, 2014
    Posts:
    63
    Can you share the code on how you solved it? Thanks.
     
  8. ChuanXin

    ChuanXin

    Unity Technologies

    Joined:
    Apr 7, 2015
    Posts:
    283
    You can check the TileFlags of each Tile set using Tilemap.GetTileFlags.

    If TileFlags.LockColor is set, the color may not be changed and is determined by the Tile. If TileFlags.LockTransform is set, the transform is similarly determined by the Tile.

    These flags can be removed or added using Tilemap.SetTileFlags, Tilemap.AddTileFlags and Tilemap.RemoveTileFlags with the according flags, which would allow you to change the color or transform.