Skip to main content
GameDev.net gamedev.net

PRO Tired of ads? Read GameDev.net ad-free and help keep the community independent with GameDev Pro — $3/month.

UPROPERTY basics in Unreal - How to write C++ variables for Unreal blueprint - Update 5

UPROPERTY basics in Unreal - How to write C++ variables for Unreal blueprint - Update 5

15,263 1

Update 5 How to write C++ variables for Unreal blueprint; UPROPERTY Basics

What's wrong with just putting EditAnywhere on everything? Here I explain the different mark up keywords for configuring UProperty variables for the editor.


The reason you don't want to use EditAnywhere on everything, is that you are relaxing your intention beyond usefulness and potentially into detrimental territory. There are times where you only want the defaults of an actor to be editable; you don't want all actors placed in the world to have that property modifiable independently. By restricting to EditDefaultsOnly you have more control over all actors in a level. IMO the default keyword you should use is EditDefaultsOnly, and then expand that to EditAnywhere on a case-by-case basis.


Here I start the discussion of the UPROPERTY features you can specify in code. In this first video I cover what might be the most used mark up for properties. We will further explore this in later videos.


0:00 Set up

0:15 Bare UProperties

0:27 Adding EditDefaultsOnly to make it appear in the editor

0:45 UProperty name display in editor

0:54 Changing code variables in Editor

1:04 EditInstanceOnly to modify actors in a level

2:00 EditAnywhere to modify defaults and instances in a level

2:30 Edit mark up doesn't give blueprint access

3:04 BlueprintReadOnly to allow blueprint scripts to read (get) the variable.

3:23 BlueprintReadWrite to allow blueprint scripts to get and set a variable.

3:50 BlueprintReadWrite variables don't allow defaults set

4:04 Mixing BlueprintReadWrite and EditAnywhere keywords to achieve maximum blueprint exposure.

4:40 Visible Keywords (VisibleDefaultsOnly, VisibleInstanceOnly, VisibleAnywhere)

5:37 Outro to part 1

Recommended resources

Game Engines

See full guide
Unreal Engine 5 Best Practices cover
Editor pick

Unreal Engine 5 Best Practices

Amazon · Book

Written by multi-award-winning Unreal generalist Tyson J. Butler-Boschma, Founder and Creative Director of Toybox Games Studios, this book addresses common challenges you face when advancing your expertise in lighting, environment design, and cinematic storytelling.

GameDev.net may earn a commission if you purchase through these links. This helps fund the site at no extra cost to you.

GameDev.net may earn a commission if you purchase through these links. This helps fund the site at no extra cost to you.

Discussion

Loading comments...