You've just got a precedence problem. You've got:
(int) x + y
which is equivalent to
((int) x) + y
... which will then promote the result of the cast back to a float in order to perform floating point addition. Just make the cast apply to the whole result instead:
(int) (x + y)
Where x and y are the rather long expressions in your original code, of course. For the sake of readability, I'd extract the two values to separate local variables, so you'd have:
int sumX = (int) (Terrain.activeTerrain.transform.position.x + tilePositionInLocalSpace.x); int sumY = (int) (Terrain.activeTerrain.transform.position.z + tilePositionInLocalSpace.y); cube1.name = string.Format("Terrain_{0}_{1}", sumX, sumY);
Or better still:
var position = Terrain.activeTerrain.transform.position; int sumX = (int) (position.x + tilePositionInLocalSpace.x); int sumY = (int) (position.z + tilePositionInLocalSpace.y); cube1.name = string.Format("Terrain_{0}_{1}", sumX, sumY);