Is there a way to show the count of objects your currect selection? I have a bunch of overlapping objects (at least the bounding rect), and I need to keep the amount within limit for given areas, and hence such a count would be nice to see somewhere. I can’t find it (apart for manually counting selected objects in the Objects overview)
Not visible in the GUI, but you can get a count via the Tiled console (you can open it with the dark icon in the bottom left corner) with tiled.activeAsset.selectedObjects.length
I agree it would be nice to have the count visible in the GUI, perhaps in the status bar as part of the Select Object Tool’s output.
Oh, thanks! Didn’t know I could use the console like that! Great!
hello, i use Select Same Tile function to select all my Gold Mine tiles across the map
then i typed the script to the console but the result was 0 - don’t have much experience with this so maybe i did something wrong or the code isnt working in this version
This thread is about counting selected Objects. The Select Same Tiles tool selects tiles in Tile layers, it has nothing to do with Objects. To get the number of selected tiles (or rather, cells), you’ll have to calculate the area of the selection:
tiled.activeAsset.selectedArea.get().rects.reduce((area, rect) => area += rect.width*rect.height, 0)
thx, that was exactly what i needed