+2 votes

If not, how do you find all instances of a rename of a variable or object.

in Engine by (161 points)

3 Answers

0 votes
Best answer

There is nothing currently that will do that, but you can try using an external editor like Visual Studio Code, and try to do a Global Search/Replace. It is not perfect, but it can help.

-- Paul

by (82 points)
selected by
–2 votes

Groups will work for this. That is just add every object when it is spawned to a group then call the group.

Godot's groups also work kinda like C# interfaces, you can call a function that every object in the group will try to run.

by (1,428 points)

I was asking how to change all occurrences of a variable similar to what is done in other IDEs (usually called refactoring). Are you saying groups is a work around?

Yes and no.
Godot's GDscript has no support for changing variables across all code.
However Godot is designed to work from the main scene down. So using groups you could have one main variable in a parent object, that you only have to change once.

GDscript is a infant coding language with only the bare basics, doesn't even support cases yet.
It is never going to be as useful as C# or any well developed scripting language, it can't be because making a language is as much work as making a whole engine.

I believe that GDscript will eventually fade into a visual scripting language and C# will replace it in the long run.

Sorry for taking this long to reply, I was never informed of your comment.

From the looks of it GDScript is pretty solid and is specifically designed for the Godot gaming engine. I feel C# is oversold because it is overly complex for most things one wants to do in a gaming. (I coded in Unity and know C#.) GDScript now has type hinting, which means JIT will be forthcoming and the Editor is a big help. Also a Refactoring app can easily figure out what needs to be changed.

It is a matter of priorities I and someone to implement it but certainly doable.

I also believe it is doable but I don't see it happening. As you say it is a matter of priorities, the Godot devs do not believe that GDScript is a priority right now.

It has been over 3 years since refactoring has been brought up, the Godot developers simply have too much problems to deal with to focus on implementing it.
C# was integrated this year.

Engines normally follow the pattern of 1 primary language and 1 easy to use language. Maintaining more is just a drain on limited resources.

Although, personally I would like if GDScript remained instead of the visual scripting.

+1 vote

You can select the variable and then use CTRL + SHIFT + F and Replace.... It opens a search window at the bottom, allowing you to replace every occurrence of that variables name.

by (26 points)

I hope OP's glad he finally was told how to do this after 2 years of wondering! (jk)

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.