godot: export doesn't work with enums from another script/class
neither of the following work, where g
is set to autoload
export var type = g.BMW
export(g.Type) var type = g.BMW
gives error:
built-in:7 - Parse Error: invalid index 'BMW' in constant expression
modules/gdscript/gdscript.cpp:583 - Method/Function Failed, returning: ERR_PARSE_ERROR
this works tho’:
var type = g.BMW
See attached project godot-dbg.zip
edit although it seems that if you close&reopen the project (possibly the scene, didn’t try that one) the error disappears so you might have to recreate from scratch the simple project I attached.
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 4
- Comments: 17 (10 by maintainers)
Commits related to this issue
- Fix enums coming from other classes without preload Fix #19704, fix #26001 — committed to bojidar-bg/godot by bojidar-bg 5 years ago
This also seems to happen with built-in enums.
export (Tween.TransitionType) var transition_type := Tween.TRANS_CUBIC
gives me the error
invalid index 'TransitionType' in constant expression
The fix was included in 3.1 beta 3, but the bug is indeed still reproducible in the current master branch (5fa5678).