Add support for enum script component properties
- Dominant language
- C++
- Stars
- 6.3k
- Forks
- 455
- Avg merge
- 1d 21h
- Merged PRs (30d)
- 127
Description
**Is your feature request related to a problem? Please describe (REQUIRED):**
Inconvenience of usage of script component properties with e.g. hashes, than can have typos.

**Describe the solution you'd like (REQUIRED):**
Allow to use a table of hashes in go property API to define a "enum" of available values (hashes or integers?) to choose from.
```lua
go.property("card_types", { hash("special_card_1"), hash("special_card_2"), hash("normal_card_1") })
go.property("spawn_amount", { 2, 5, 10 })
```
Then in Properties Pane in Editor - those can be selected from a drop-down menu (similarly like e.g. some GUI properties:)

**Describe alternatives you've considered (REQUIRED):**
Group several other existing properties into a "group" ?
```lua
go.property("type_1", 1)
go.property("type_2", 2)
...
go.group_properties({"type_1", "type_2", ... })
```
**Additional context (OPTIONAL):**
https://forum.defold.com/t/enum-script-properties/12620
Similar:
https://github.com/defold/defold/issues/10655
Contributor guide
Research direction
Start by tracing the go.property API and the Editor Properties Pane described in the issue. Read related issue #10655 and the linked forum discussion, then clarify the representation of enum hashes or integers and verify that the selected values appear as a dropdown in the editor.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- lua
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100