Get distance from center to edge of an object

GetComponent<Collider>().bounds.size.z
Returns either 0 or 1 or Vector3 with same values. No errors, all references fulfilled.
My object does have a Collider, exists in Edit Mode (so no prefab).

I placed a cube around the border it should return at least 460 on X.
The closest I got for printing it is (0.0, 0.0, 0.0) or (1.0, 1.0, 1.0)
How do I get the further most X and Z point, in world coordinates?

Edit: This isn’t the only code I’ve tried, but I’ve lost track of previous samples.

Get the MeshFilter’s shared bounds. IIRC, those are axis-alinged bounds, but usually that’s good enough.

It returns 5. That’s not the right number.

GetComponent<MeshFilter>().sharedMesh.bounds.max.x;

Hmm.You may need to check the scale factor of your object and multiply

How do I get scale factor? It’s not part of regular API.

No code found through search engine.

It seems it has something to do with importing files from external programs.
But the plane that I use is created by Unity.

I think they’re just referring to transform.localScale. If that’s anything but 1 the mesh bounds’ numbers would be different than what you see in the scene.

Indeed I meant transform.localScale - your mesh’s size and therefore bounds are affected by scale. If your mesh was built (like a cube) to reach from -0.5 to 0.5, a scale of 10 would make the mesh go from -5 to 5

GetComponent<MeshFilter>().sharedMesh.bounds.max.x * transform.localScale.x
Also returns 5. I doubt subtracting them will get me ~420 (real physical map distance from center)

I think I know why. It gives me it’s child’s distance to the sides. Meaning if a child object of it’s parent objects wants to get to the edge. I should set it to 5. However I need it in world distance, i.e. how far the the side would I need to place this entirely separate mountain to the side, for it to be on the side of this plane. new Vector3(0, 0, ???); type of deal.

I need to place a new item on edge of this item. Without it being it’s parent.