Some characters in variable names not working anymore in new GD version


I’ve just updated GD to the latest version (5.3.180). I was previously using the version 5.2.172.

Some of my projects are not working anymore, and I think I noticed why: some characters that used to be acceptable in variable names, are not anymore. There are at least two: space, and ‘#’

I know space has always been said as ‘not recommended’ for variable name. My bad to have use it.
Now space doesn’t work anymore, but is still said as ‘not recommended’ in the red alert message. This might be something to fix, since it is not ‘not recommended’ but actually ‘impossible’.

‘#’ is not allowed anymore in variable names, but it was before.

I haven’t got the time to install other versions to find out when the change occurred, but it might be in version 5.2.175, since in its release info it is written:

« Variable names that have forbidden characters are automatically fixed, not breaking your workflow. »

So I understand my problem is not really a bug, but probably a necessary change in GD.
Still I’d have a few questions to help me adapt my projects:

  • Are there other changes that could cause projects not to work anymore on latest versions (mostly changes about variables)?
    • Are there other characters that became forbidden (other than space and #) ?
  • Is there a way to look for syntax errors (red underlined) in project / scene events? (If not it could be a handy feature)

Thanks a lot for your reading!

1 Like

I can only answer some of this, but hope this helps.

To add clarity, the big change was just outright forcing them to not be allowed in the name fields. These were never valid characters for variable names, because they’re not valid characters for variable names in javascript. They were always forbidden, and if you ever fully built your game it would likely crash when it got to something that used those variables.

Yes, absolutely. Breaking changes are part of software development, but the dev team tries to avoid them as much as possible, and they’re normally documented/alerts are made/etc.

The only acceptable characters are A-Z, 0-9, and - (hyphen) or _ (underscore). Edit: $ might be acceptable in Javascript, but I don’t remember if it’s acceptable in GDevelop or not. Also, variable names cannot start with a number or hyphen.

1 Like

Thanks a lot for your reply @Silver-Streak
I took the bad habit to use any kind of characters (space, #, @…).

I see… the project I was talking about was never built, and it was working since I was only previewing it in GDevelop

This is very useful. Thanks a lot. That’s good practice I should have had for a long time. I’ll stick to it from now on.