First of all, thank you for all your work on Tiled2Unity. :-)
I found an issue in depth buffering an exported Tiled map.
It only works when the ExportScale of the map is 1. Otherwise, the calculated values are too small and tiles are mosty displayed above sprites,
The affected code is line 55 in SpriteDepthInMap.cs :
float depth_z = (spritePosition.y / mapRect.height) + (depthPerLayer * this.InteractWithLayer);
If the export scale is different than one, it will not work, as the sprite position is in units and the mapRect height is in pixels.
Dividing the sprite position by the export scale of the map fixes this issue:
float depth_z = (spritePosition.y / this.AttachedMap.ExportScale / mapRect.height) + (depthPerLayer * this.InteractWithLayer);
I tested this with an export scale of 0.0625 (16 pixels per unit when exporting from tiled).
First of all, thank you for all your work on Tiled2Unity. :-)
I found an issue in depth buffering an exported Tiled map. It only works when the ExportScale of the map is 1. Otherwise, the calculated values are too small and tiles are mosty displayed above sprites,
The affected code is line 55 in SpriteDepthInMap.cs :
float depth_z = (spritePosition.y / mapRect.height) + (depthPerLayer * this.InteractWithLayer);
If the export scale is different than one, it will not work, as the sprite position is in units and the mapRect height is in pixels.
Dividing the sprite position by the export scale of the map fixes this issue:
float depth_z = (spritePosition.y / this.AttachedMap.ExportScale / mapRect.height) + (depthPerLayer * this.InteractWithLayer);
I tested this with an export scale of 0.0625 (16 pixels per unit when exporting from tiled).