When developing with Unreal, it is common for programmers to implement properties on Actors or other objects in C++, and make them visible to the editor for designer use. However, sometimes it makes sense to view a property, or to make it editable, but only on the object's default state. Sometimes the property should only be modifiable at runtime with the default specified in C++. Fortunately, there are some specifiers that can help us restrict when a property is available.
Actor
class in the editor called PropertySpecifierActor
.UPROPERTY(EditDefaultsOnly) bool EditDefaultsOnly; UPROPERTY(EditInstanceOnly) bool EditInstanceOnly; UPROPERTY(EditAnywhere) bool EditAnywhere; UPROPERTY(VisibleDefaultsOnly) bool VisibleDefaultsOnly; UPROPERTY(VisibleInstanceOnly) bool VisibleInstanceOnly; UPROPERTY(VisibleAnywhere) bool VisibleAnywhere;
UPROPERTY
, we can indicate where we want that value to be available inside the Unreal editor.Visible*
prefixes indicate that the value is viewable in the Details panel for the indicated object. The value won't be editable, however.const
qualifier; however, native code can change the value, for instance.Edit*
prefixes indicate that the property can be altered within the Details panels inside the editor.InstanceOnly
as a suffix indicates that the property will only be displayed in the Details panels for instances of your class that have been placed into the game. They won't be visible in the Class Defaults section of the Blueprint editor, for example.DefaultsOnly
is the inverse of InstanceOnly
— UPROPERTY
will only display in the Class Defaults section, and can't be viewed on individual instances within the level.Anywhere
is the combination of the two previous suffixes—the UPROPERTY
will be visible in all Details panels that inspect either the object's defaults or a particular instance in the level.18.190.155.49