Property, member variable
2025/12/27
- Type
- Learning Resource
- Format
- Glossary Article
- Version
- General
- Subject Tags
- Created
- Updated
- 2026/02/16
- 2025/12/27
A property, which we also commonly call a member variable, is a variable attached to and stored in an object, an entity that groups data (variables) and functions.
In Godot, nodes have many properties. Let's take the Sprite2D node for example:
texture property stores the image displayed by the sprite.position property stores the position of the sprite in the game world.visible property stores whether the sprite is visible or not.In a script file, in GDScript, whenever you define a variable outside of functions, it is a property (you can also call it a member variable). For example, this script adds a health property to any 2D node it's attached to:
extends Node2D
var health := 100Properties and member variables are closely-related programming concepts: They're both variables attached to an object, and we often use these terms interchangeably.
The nuance between them is that a property builds upon a member variable and reads and writes data through an extra mechanism, typically a getter and a setter function. In Godot, when you define a member variable, under the hood, Godot reads and writes to it through a getter and a setter function. So technically, all member variables in Godot are properties.
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.
Get help from peers and pros on GDQuest's Discord server!
20,000 membersJoin ServerThere are multiple ways you can join our effort to create free and open source gamedev resources that are accessible to everyone!
Sponsor this library by learning gamedev with us onGDSchool
Learn MoreImprove and build on assets or suggest edits onGithub
Contributeshare this page and talk about GDQUest onRedditYoutubeTwitter…