##### Posted by: Kronnect

«**on:**December 01, 2019, 02:37:58 PM »

Hey, thanks.

You can use both approaches - they will produce approximately same ratios, especifically same results with a rect grid but a slight difference if you use an hexagonal grid.

For example:

This code produces same results in the case of a rect/square grid. But if you use an hexagonal grid, the diagonal of the enclosing rect is a bit longer than the distance between two vertices of the hexagon hence the result is slightly different. In any case you can just multiply the final scale by an "adjusting" factor to match your preferences. For example, multiply it by 0.95 or 0.9 to add a small padding.

Regards

You can use both approaches - they will produce approximately same ratios, especifically same results with a rect grid but a slight difference if you use an hexagonal grid.

For example:

Code

` Bounds tileBounds = tgs.CellGetRectWorldSpace(0);`

float tileSize = Vector3.Distance(tileBounds.min, tileBounds.max);

float spriteSize = Vector3.Distance(sprite.bounds.max, sprite.bounds.min);

float scale = tileSize / spriteSize;

This code produces same results in the case of a rect/square grid. But if you use an hexagonal grid, the diagonal of the enclosing rect is a bit longer than the distance between two vertices of the hexagon hence the result is slightly different. In any case you can just multiply the final scale by an "adjusting" factor to match your preferences. For example, multiply it by 0.95 or 0.9 to add a small padding.

Regards