Can not get height property of mesh in C#

Godot Version

4.2

Question

I am following a tutorial where GDScript is being used and I try to follow the tutorial while converting the code to C#. In GDScript you can easily get the height of a mesh by just this:

meshInstance3D.mesh.height

but in C# the same thing does not work. Mesh does not contain anything called Height and i was unable to find a solution for a while now even with quite a bit of research. Any help is appreciated. Thank you in advance.

1 Like

What kind of mesh is it? Since the base abstract class of Mesh does not include the size indeed, but if it’s, for example, a BoxMesh, you can get it with the Size property.

Try to cast your mesh into it’s specific type first.

1 Like

It was a cylinder mesh. Thanks to your reply I was able to solve it. Thank you good sir!

you need to cast to the appropriate type, you can’t do the same unsafe access in C#

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.