Function naming convention continued

I was exploring limiting the scope of functions and variables so code that is only meant to be used by a script isn’t available for other scripts to use. As far as I can tell GDScript doesn’t provide that kind of functionality. What I did find is a naming convention of using two underscores to start function/variable names that you want to be reminded not to use from other scripts e.g. func __function_only_meant_to_be_used_inside_this_script():

yea, they sort of followed Python with that respect. there isnt a strict way to have public / private variables or methods.

the style guild just says to use the trailing underscore to denote methods that are private or internal methods that need to be overridden.

even the use of the getter / setter doesnt really encapsulate alot, but might make things a bit tighter.
i just use the _ for private and try to remember not to access it externally :frowning:

< GDScript style guide — Godot Engine (stable) documentation in English>

1 Like

Privacy & Terms