This appears to be a bug to me, but maybe someone can let me know if something is wrong that I’m missing.
When my player runs into a tilemap tile that they can destroy, then this error will happen only on the first collision:
Assertion failed on expression: ‘ValidTRS()’
private void OnCollisionEnter2D(Collision2D collision)
{
if (collision.collider.CompareTag("CollisionTilemap"))
{
Vector3 contactPoint = collision.contacts[0].point;
Vector3Int tilePosition = collisionTilemap.WorldToCell(contactPoint);
TileBase tile = collisionTilemap.GetTile(tilePosition);
if (tile != null)
{
collisionTilemap.SetTile(tilePosition, null);
}
else
{
Debug.Log("No tile found at position: " + tilePosition);
}
}
}
This only happens when colliding with the composite collider on the tilemap.