You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
var y = Globals.COLOURS.blue #works fine as var
const z = Globals.COLOURS.blue
I get error invalid index COLOURS in constant expression.
Maybe this is more a 'feature request', but you would expect autoload variables to be loaded first or at least a script able to know of the autoload's existence as it parses the code...
The text was updated successfully, but these errors were encountered:
A singleton reference is not constant because the first part (Globals) is a result of get_node(), which itself is not a constant expression. I wouldn't consider this to be a bug.
Stuff like this could be solved by introducing immutable variables, but it's not likely to happen soon.
I get what you're saying, but constants are "known at compile-time" according to the docs, which implies it is defined regardless where it is declared, it is simply known at compile time?
So an autoload having a constant means the value is known at compile time. So that implies that a const based off a const is also perfectly valid because that is done at compile time?
Godot version:
3.2.3
OS/device including version:
Linux
Issue description:
I know enums don't work very well with singletons/exports but I have the following in an autoload:
If I try to create a constant using it:
I get error invalid index COLOURS in constant expression.
Maybe this is more a 'feature request', but you would expect autoload variables to be loaded first or at least a script able to know of the autoload's existence as it parses the code...
The text was updated successfully, but these errors were encountered: