Search Unity

  1. We are looking for feedback on the experimental Unity Safe Mode which is aiming to help you resolve compilation errors faster during project startup.
    Dismiss Notice
  2. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

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,742
    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,742
    any one?
     
  3. castor76

    castor76

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

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    1,742
    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,742
    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,742
    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:
    122
    Can you share the code on how you solved it? Thanks.
     
  8. ChuanXin

    ChuanXin

    Unity Technologies

    Joined:
    Apr 7, 2015
    Posts:
    512
    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.
     
unityunity