Private/Public Properties

2025/12/27

Type
Learning Resource
Format
Glossary Article
Version
General
Subject Tags
Code
Assets
All else
Copyright 2016-2026, GDQuest
Created
2026/02/16
Updated
2025/12/27

Private/Public Properties

In large organizations, is necessary. It allows different teams to work on different parts of the codebase without needing to know how the other parts work internally, as long as they know how to interact with them.

Each team is free to work on their parts of the code in any way they want, as long as all teams agree on how the external should look.

In some languages, this can be enforced at a language level, by marking properties as private or public. A private property is only accessible from within the script it is defined in, while a public property can be accessed from other scripts. Some languages also have protected properties, which are only accessible from subclasses.

In GDScript, there's no private or public keyword. Instead, GDScript uses a convention to mark properties as private or public. A property is considered private if its name starts with an underscore (_). This is called pseudo-private. It's a convention, not a language feature, so it's up to the programmer to respect it.

Become an Indie Gamedev with GDQuest!

Don't stop here. Step-by-step tutorials are fun but they only take you so far.

Try one of our proven study programs to become an independent Gamedev truly capable of realizing the games you’ve always wanted to make.

Nathan

Founder and teacher at GDQuest
  • Starter Kit
  • Learn Gamedev from Zero
Check out GDSchool

You're welcome in our little community

Get help from peers and pros on GDQuest's Discord server!

20,000 membersJoin Server

Contribute to GDQuest's Free Library

There are multiple ways you can join our effort to create free and open source gamedev resources that are accessible to everyone!