0 votes

A lot of the engine class members have set/get methods. Should I use those or can I just directly use the member variable?
An example is "owner".
Should I do:

set_owner(parent)

or

owner = parent

?

I suppose it's the same and the user can choose what fits him better, but I like to follow guidelines/rules, and there doesn't seem to be anything in the docs about this.
There is http://docs.godotengine.org/en/3.0/getting_started/scripting/gdscript/gdscript_styleguide.html , but nothing about this issue.

in Engine by (37 points)

1 Answer

0 votes
Best answer

Using the member variable is preferred. Note that the autosuggest as you type will only suggest members, not set/get functions.

I will update the styleguide to reflect this.

by (20,673 points)
selected by
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.