+1 vote


Ho do I create an export variable whose value I can select from multiple pesets in a dropdown menu?

In Unity it would look like this in code :

public List<var> list = new List<var>();

Is it possible in Godot? If so, how is it done?

Godot version v3.2.3.stable.official
in Engine by (73 points)

1 Answer

+1 vote
Best answer

The magic word is Array not List for GDscript (your question is marked gdscript but you have C# code, are you using Mono?)

export(Array) var arr = [

EDIT: I don't really understand what you mean by presets, do you want a dictionary of bools with the ability to turn some of them on/off in the Editor inspector?

by (735 points)
selected by

No, the code is an example of how it's done in Unity. I want to do the same thing in Godot in GDScript.

I want to be able to set the variable in the inspector with a dropdown menu containing custom options that map to an index. Is it possible in Godot?

I'm pretty sure I understand now, my apologies. It is possible (and I learned something finding this)! Here is where someone has asked about it before, with further links to the docs.

export(int, "option1", "option 2", "option 3") var my_custom_property

It works, thanks!

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.