Property, member variable

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

Property, member variable

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:

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 := 100

The technical difference between property and member variable

Properties 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.

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!