Using the new variables version you can’t specify if you’re using a scene or global variable, you just enter the name of the variable. But using a code that was written with the old version I have many global variables that have the same name as scene variables. So how is it going to work? Which one would be changed?
Shared names between Objects and variables (in any combination of global or scene) are not supported.
You will need to rename the variables sharing the same name.
Edit: there’s more info in the wiki page about variables on the conflict priority used, specifically here:
https://wiki.gdevelop.io/gdevelop5/all-features/variables/#using-a-variable-in-expressions
and nobody thought about this issue when creating the new version? this is crazy. I have hundreds of variables and now have to change the names one by one in every events they appear. How come nobody thought about this? And why no automatic declaration is implemented?
Not really sure I understand your question. There’s not a “nobody thought about this”. There were tons of posts and wiki updates and information in the update log about it.
You can either use an old version or update your project. Those are your options.
Ok, reading your edit now.
I see you liked my post about new vars
My mind did NOT change about them
But same as with drinks
Either i gonna buy pepsi with half sugar that it used to have
Or i can drink water or tea
Same story here
Choice was made i am more than sure it was NOT like
OK fak all users and let’s go with not allowing same var names
I bet A LOT of decisions were made after a lot of considering if option A or B will be better
I say better system would be if in text it would display if its scene or global var
And now we could have same names for vars
Like that icon would be prefix but seems it can’t be part of text
But whatever truth is it most likely not gonna change and we need to adapt
Or use old version of gdevelop
Fak i remember times where internet browsers did not have tabs in them
And each site was opened in new window instance of browser
Things just change i can’t argue over how cool is now to update all your vars in all your events sheet just by editing it in variable window
Yet i stil miss how old system did allow me to not declare anything
And this IDK if will help you but i did decide to (if i really need same names)
Going with just name of my var for global variables
And same name of var with S on beginning if its scene var
So like i have HP var which would be global and SHP var as scene var
That is only solution i came up with
And how that helps you?
You do have expression GlobalVariable(HP) Variable(HP)
And if you hit ctrl + F you can replace text of all of them
So you could FIRST change GlobalVariable(HP) to GHP
And then Variable(HP) to SHP now you could rename GHP to just HP
Maybe in this case it would make more sense to just leave global vars as GHP and scene vars as HP
But i use more global vars than scene vars so i would prefer to mess scene over global
So in other words
You will NOT have such a problem
CTRL + F will help you A LOT to streamline your transition to new system
I’m doing something similar. Add a letter at the end.
It’s a pain!
The worst is that they could make the editor much easier to use and the new version would not be so painful. For example when you search for a name, instead of having the whole block of event highlighted the variable name itself could be highlighted. Another example is how the declaration of a new variable gets you to scene variables window. If you want a global variable you have to delete that scene variable that was added automatically, go to global , click add, erase the new name, paste your variable name. Doing this with hundred of variables is crazy!!!
I wonder if the team use the editor at all, or if they care. They seem pretty hermetic to users issues and preferences. Hopefully i’m wrong.
It was not meant to nicely transition from old to new system
But to work nicely with new system
So only transition phase is painful
Later it won’t be so painful to manage it
Like in most cases “lets care more about new users rather than old users”
But as soon as all users will use new system there will be no argument over it
So like lets bite it and just move along