Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice
  4. Dismiss Notice

Bug Sprites Randomly Changing in Grid

Discussion in '2D' started by Lehmyare, May 8, 2021.

  1. Lehmyare

    Lehmyare

    Joined:
    Feb 7, 2021
    Posts:
    3
    Unity Version: 2020.3.0f1
    Unity Collab



    3 Rectangular Tilemaps under 1 Grid: Walls (Collision), Floor, and Carpet
    Each of the Walls, Floors, and Carpets are using a different palette.
    The Wall tilemap has a Rigidbody 2D, CompositeCollider 2D, and TilemapCollider 2D. Was informed that problem arisen after the TilemapCollider 2D was added to the Wall tilemap.

    The person working on level design informed me about a bug where specific tiles would randomly change. Upon further investigation, I found that the grid spots that are changing are swapping their sprite with another grid spot. This only occurs while using the brush tool in the palette and while hovering over the grid spot that changes. The connected grid spots, that swap sprites, stay the same across all the affected tiles. This also only occurs on the "Walls" tilemap and isn't appearing on the "Floor" or "Carpet" tilemaps.

    Upon selecting a grid spot, when the tile has swapped, it shows that the Tile is, for example, "wall_473 (tile)", but the Sprite is "wall_399". But when the exact same grid spot is back to normal, both the Tile and Sprite show "wall_473".

    I've spent an hour or two trying to find a solution to this problem, but to no avail, leading me to make this post. Thank you for any help.
     
  2. ChuanXin

    ChuanXin

    Unity Technologies

    Joined:
    Apr 7, 2015
    Posts:
    1,068
    Hi, could you file a bug report using the Unity Bug Reporter with your project and post the case number here? Thanks!

    It seems there is some oddness from the beginning as the walls on the right side have the purple Sprite already without any cursor interaction.
     
  3. pgpais

    pgpais

    Joined:
    Nov 23, 2015
    Posts:
    12
    I also have this weird behaviour on Unity 2020.2.0f1

    My setup is I have several prefab variants based on another prefab with two grids (one for ground and another for walls). I use these variants to be able to spawn rooms in a random manner (so several grid objects are instantiated, not sure if this is good practice).

    I haven't tracked down the source of the issue completely, but it seems that when I make changes to the root prefab, all the variants of it change some tiles from their grid. The changed tile seems to be completely random (didn't find any cause, at least).

    Hope this helps! I can also, try some stuff out if you need to track down the cause.

    EDIT: It might be worth mentioning that I also have a Composite and Tilemap Collider in my grid objects.

    EDIT #2: To work around the problem I need to revert the prefab variant's grid.
     
  4. Lehmyare

    Lehmyare

    Joined:
    Feb 7, 2021
    Posts:
    3
    Before I saw your reply, I pseudo fixed the issue by recreating the entire tile map, as well as creating and using a new palette to recreate the tile map, then deleting the effected tile map and related palette. It is still happening (with a different tile map & palette), but not to the same extent (a single grid piece) and I can't reliably change the grid spot as I could previously. If you would still like me to make the Bug Report, I will do so. But until I can reliably have the bug "working" as I did before, I'm going to hold off on making the Bug Report. If it does continue to be an issue / escalates I'll make the Bug Report and post the Case Number here if I do.

    Thank you for your reply and your time.
     
  5. Lehmyare

    Lehmyare

    Joined:
    Feb 7, 2021
    Posts:
    3
    Case ID: 1340352
     
  6. ChuanXin

    ChuanXin

    Unity Technologies

    Joined:
    Apr 7, 2015
    Posts:
    1,068
    Will check it out, thanks!
     
  7. ChuanXin

    ChuanXin

    Unity Technologies

    Joined:
    Apr 7, 2015
    Posts:
    1,068
    Hi, this issue is fixed in the 2021.1 Unity Editor. We will try to backport the fix to the 2020.3 LTS Unity Editor!