Search Unity

Tilemap Colliders Not All There???

Discussion in '2D' started by Vaulcul, Jun 10, 2020.

  1. Vaulcul

    Vaulcul

    Joined:
    Apr 3, 2016
    Posts:
    45
    Hi there!

    I am currently using Unity 2019.3.15f1

    I've been using the Unity Tilemap system for a while now and I ran into an interesting problem just yesterday.

    I was doing some troubleshooting on some graphical glitches (not wholly relevant to this post, I don't think) and in my process of troubleshooting, I deleted and re-imported the tilesheet set.

    After re-importing the tilesheet, all seemed good, as all of the graphics were put back in place.

    However, I have a Tilemap object called "Ground-Non Traverse" as you would imagine it has a Tilemap Collider 2D (and a composite collider 2D) on it to keep the character from being able to pass through it. This happens on a few more of the tilemaps, but this is by far the most notable.

    Now, not all of the tiles are receiving the colliders, only some. It's harder to explain without showing:

    ALL TILEMAPS ENABLED IN SCENE (note the colliders):
    upload_2020-6-9_20-0-4.png


    JUST THE GROUND NON-TRAVERSE DISABLED (note what was turned off)
    upload_2020-6-9_20-0-56.png

    Note the difference in the two pictures, specifically where the colliders are in comparison to what's been turned off...

    I've deleted and re-added the colliders from the tilemap object and the problem persists.

    I've even gone so far as to delete the library folder and let Unity rebuild it.

    The only error in the console is 5 of the following:

    The same field name is serialized multiple times in the class or its parent class. This is not supported: Base(MonoBehaviour) playerId


    I've looked this error up and I can't find any good cause for it... nor do I think it's adversely affecting the scene or causing this problem (it existed before the problem did).

    I've checked all of the scripts for errors and am unable to find any.

    Any help/ideas as to why this has started to do this and how I can fix it.

    Thanks much.
     
  2. ChuanXin

    ChuanXin

    Unity Technologies

    Joined:
    Apr 7, 2015
    Posts:
    1,068
    Could you use the "Select" tool and select the Tile that does not generate a collider in the "Ground-Non Traverse" Tilemap and post a screenshot of the Inspector here? If you are using custom Physics Shapes, could you select the Sprite of the Tile, open the Sprite Editor and share the custom Physics Shape of the Sprite? That would be helpful, thanks!
     
  3. Vaulcul

    Vaulcul

    Joined:
    Apr 3, 2016
    Posts:
    45
    ChuanXin,

    Thanks for your reply! It's really appreciated!

    As requested here's a screenshot of the inspector information associated w/ a tile that DOES NOT generate a collider:
    upload_2020-6-10_18-55-13.png

    For reference, here's a screenshot of the inspector information associated w/ a tile that DOES generate a collider:
    upload_2020-6-10_18-42-55.png

    I've confirmed by clicking through a few more tiles that those with the collision issue seem to all be animated tiles and that the "Lock Color" check box is not checked on any of them (which was interesting to discover... but I'm not really sure what it means).

    I don't believe that there are any custom physics shapes on this (not that I can tell).

    This tileset is from the asset store:
    https://assetstore.unity.com/packages/2d/environments/overworld-tileset-123120

    I am using the default settings that come with the asset.

    I'm more than happy to provide any other information you might need.
     

    Attached Files:

  4. ChuanXin

    ChuanXin

    Unity Technologies

    Joined:
    Apr 7, 2015
    Posts:
    1,068
    From the inspector screenshots, it seems that the Tile that does not generate a Collider has a Collider Type of None. This means that this Tile will not generate a Collider. The Collider Type needs to be set to Sprite or Grid to generate a Collider.

    This is likely the case for all the Animated Tiles. You will need to change the Collider Type of each of these Tiles to generate a Collider.

    If the option is not there in the Animated Tile inspector, you may need to update your AnimatedTile script to the one here:
    https://github.com/Unity-Technologi...er/Runtime/Tiles/AnimatedTile/AnimatedTile.cs

    Hope this helps!
     
  5. Vaulcul

    Vaulcul

    Joined:
    Apr 3, 2016
    Posts:
    45
    I've updated the script for the animated tiles... and I changed the '.asset' file setting for all of the animated tiles to have a collider on them... It's all there now.

    I now remember that they didn't have colliders set on them originally... I think I'm going to notate that in my notes so I don't forget again.

    Thanks much for your time and assistance.
     
  6. Csongor_Janosi

    Csongor_Janosi

    Joined:
    Oct 24, 2022
    Posts:
    1
    Hi,
    An update on this in the current version you can find the collider type on the animated tile as shown below. I hope this helps with some more recent searches. :)
    upload_2022-11-21_15-4-36.png
    upload_2022-11-21_15-4-55.png