0
\$\begingroup\$

Suppose I have some external package with objects. Suppose I place some of these object to the scene. Now how to know actual size of object in world units?

I found no any rulers or something in Unity.

The I thought I can place primitive cube and compare it, but then I realized that I don't know the size of cube too.

Is is possible to "measure" arbitrary object in Unity somehow?

\$\endgroup\$
  • 2
    \$\begingroup\$ The default cube is 1 unit wide. You can verify this by placing marker objects like quads at integer coordinates, for example, and noting that the cube fits exactly between two consecutive markers. Or checking that its BoxCollider size is 1,1,1 \$\endgroup\$ – DMGregory Jun 17 '18 at 12:25
1
\$\begingroup\$

Use the Mesh.bounds variable. From Unity's docs:

The bounding volume of the mesh.

This is the axis-aligned bounding box of the mesh in its local space (that is, not affected by the transform). Note that the Renderer.bounds property is similar but returns the bounds in world space.

Then use the Bounds.size. From Unity's docs:

The total size of the box.

size.x is the width, size.y is the height and size.z is the depth of the box.

This should give you the exact size of the mesh. Unfortunately this means you have to create a script to get the size, which may be impractical, but you can for example make it print in the Inspector the size of the mesh while you are editing.

| improve this answer | |
\$\endgroup\$
0
\$\begingroup\$

The default cube is one unit in each direction. To some extent, the units themselves are arbitrary (that is, you can assign whatever meaning you want to that size). In places where Unity uses distance (for instance, certain physics formulas), it assumes each unit is a meter.

As to measuring objects, you can make some quick estimate by using the unit cube as a reference, scale it & make comparisons.

There are also one or more distance tools in the asset store that can be used to GameObjects in your scene.

| improve this answer | |
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.