- Home /
2D Tilemaps: how to set colliders on scriptable tiles derived from Tilebase class
My Tilemap consists of custom tiles that derive from TileBase class. However when trying to add colliders to these tiles I've noticed that "colliderType" property only exists on Tile class, not TileBase class. For several reasons I'd much rather keep inheriting from TileBase. Is it possible to add collision to Tilebase-derived custom tiles?
Thanks to anyone who's able to help and please pardon me for potentially newbish question.
Answer by Yuizumi · Aug 15, 2020 at 07:36 AM
Hello. The answer for this question is here.
https://docs.unity3d.com/2019.1/Documentation/Manual/Tilemap-ScriptableTiles-Tile.html
When you set special colliderType as public Tile.ColliderType m_DefaultColliderType;
you can apply colliderType setting by
public override void GetTileData(Vector3Int position, ITilemap tilemap, ref TileData tileData) { tileData.colliderType = this.m_DefaultColliderType; }
Thanks you!
Your answer
Follow this Question
Related Questions
How can I allow the rope to correctly interact with Box and Polygon colliders? 0 Answers
Different platform effector 2d rotations for different colliders 1 Answer
How can I find the name of the tile that I collided with in 2d? 1 Answer
How can i detect how many objects of the same type i'm triggering and choose only one of them? 1 Answer
Tilemap collider doesn't appear 1 Answer