Hello there! So I'm trying to make a node that will handle multi detailed meshes, like a LOD. And I'm trying to export an array of meshes to be set outside the script, in the inspector. But I didn't understand how export hints works. Can anyone give me a light? :3

I'm not sure you can do that. Did you read what the GDScript doc has to say about it?

Regular export vars are easy. They need to be typed, which you can either do by setting a default value, or give it a flag. Like: export(int) var, export(float) var, export(NodePath) var, export(String, FILE) var, etc.

Exported arrays are a bit less convenient though. From the docs:

While regular arrays are created local to every class instance, exported arrays are shared between all instances. This means that editing them in one instance will cause them to change in all other instances. I think that alone makes what you're trying to do not work. But also, how you make them. You can type the whole array with something like: export var vector3s = Vector3Array(), but there's only certain types you can do like that: byte, int, float, string, vector2, vector3, and color. If you just make an array without that, then in the editor for each item in the array, you get a dropdown menu with a list of types. But that list doesn't happen to include Mesh or File. You could use an array of strings and load() them in script, but it's not very convenient to type in string file paths.

I think your best bet is to have a fixed number of meshes and just have individual export vars for each one. export(Mesh) var mesh_1, export(Mesh) var mesh_2, etc.

The list indirectly includes Meshes. But you have to first create a general array, then set the index to be an object, and then set the object to be a mesh. Pretty inconvenient indeed. And now with what you showed (that they may share the array between each other) I'm pretty convinced that I will have to work around it :pensive:

You could also open a github issue on the matter and see what the devs have to say.

6 years later