0
\$\begingroup\$

I'm planning create a plane with the size like 16x1x16, however, I wanna the scale of it is always 1x1x1. I found something useful information Unity change size of cube mesh. It aims to a cube mesh, any idea about plane mesh?

Or can I use a cube mesh as a plane mesh?

\$\endgroup\$
3
  • \$\begingroup\$ The "Quad" primitive is already a 1x1 plane if you don't need subdivisions. Otherwise, you'd need to make your own mesh using the Mesh class, similar to what's shown in the thread you link. Where did you run into trouble adapting this to generate a plane instead? \$\endgroup\$
    – DMGregory
    Sep 28, 2021 at 11:43
  • \$\begingroup\$ Basically I want some small grids to combine a big plane, and the number of grids can be controlled by user. Then I found Probuilder plugin can do that, I won't do it by myself^_^ \$\endgroup\$ Sep 29, 2021 at 9:32
  • \$\begingroup\$ If what you want to do is build level geometry out of small square tiles, be sure to ask that instead. We could have suggested ProBuilder if we knew that was what you wanted. Want to write up your solution as an answer below? \$\endgroup\$
    – DMGregory
    Sep 29, 2021 at 11:23

1 Answer 1

0
\$\begingroup\$

I googled for a while and change-size-of-mesh-at-runtime is a solution. However, a plane's mesh is still there after following the code. It seems a plane's mesh copies another piece and scales based on that code and the original one keeps its size and can't be scaled. So there are two pieces of meshes in a plane, a bit weird.

As a result, I used the ProBuilder plugin to solve this problem. (This is a free add-on available from Unity's Package Manager.)

Using the method ShapeGenerator.GeneratePlane(PivotLocation pivotType, float width, float height, int widthCuts, int heightCuts, Axis axis) the plugin provides, you can achieve the goal.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .