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
Note: there is a simpler legit way to do the same thing you just did:
Create a normal script inheriting Resource, put non-const vars inside, create a Resource in the inspector, put the script on it, and save as file. Now you can preload it and use it as pseudo-singleton with shared vars as long as the resource is referenced somewhere at runtime.
But honestly, an autoload is closer to globals if that's what you want.
This still isn't global vars, but the hack you used technically did that AFAIK.
If this is really wanted we can add static variables (assuming it could work properly, see discussion in #6840). But allowing constants to be reassigned is a big problem and maybe the source of many game bugs when done by mistake, so I'm 100% against it.
Godot version:
Godot 3.1.dev compiled with 8bc9986
OS/device including version:
Arch Linux x64
Issue description:
In GDScript I always define static variables with the keyword
const
.The code below works fine from godot 2 to godot 3.0.
In the new version of godot compiled from master branch. This code parse failed with this message
Please consider remove this syntax checking or add a new way to define static variables like this
The text was updated successfully, but these errors were encountered: