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

Published April 13, 2024
Advertisement

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

0 likes 0 comments

Comments

Nobody has left a comment. You can be the first!
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Advertisement